-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
104 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
roles/oneagent/tests/component/resources/installers/Dynatrace-OneAgent-Linux.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/bin/sh | ||
|
||
# This script acts as a self contained installer of the procuct | ||
|
||
readonly DEFAULT_INSTALL_DIR="/opt/dynatrace/oneagent" | ||
readonly INSTALLER_VERSION="##VERSION##" | ||
readonly DEPLOYMENT_CONF_PATH="/var/lib/dynatrace/oneagent/agent/config" | ||
|
||
readonly UNINSTALL_SCRIPT="uninstall.sh" | ||
readonly UNINSTALL_CODE="$(cat <<-ENDUNINSTALL | ||
##UNINSTALL_CODE## | ||
ENDUNINSTALL | ||
)" | ||
|
||
readonly ONEAGENTCTL_BIN="oneagentctl" | ||
readonly ONEAGENTCTL_CODE="$(cat <<-ENDCTL | ||
##ONEAGENTCTL_CODE## | ||
ENDCTL | ||
)" | ||
|
||
CTL_PARAMS= | ||
INSTALL_DIR="${DEFAULT_INSTALL_DIR}" | ||
|
||
parseParams() { | ||
while [ $# -gt 0 ]; do | ||
local param="${1}" | ||
if [ "${param}" = "--version" ]; then | ||
printf "%s" "${INSTALLER_VERSION}" | ||
exit 0 | ||
elif [ "${param}" = "INSTALL_PATH" ]; then | ||
INSTALL_DIR="$(printf "%s" "${param}" | cut -d "=" -f "2-")" | ||
elif printf "%s" "${param}" | grep -q -- "--set"; then | ||
CTL_PARAMS="${CTL_PARAMS} ${1}" | ||
fi | ||
shift | ||
done | ||
} | ||
|
||
uninstall() { | ||
local uninstallScript="${INSTALL_DIR}/agent/${UNINSTALL_SCRIPT}" | ||
if [ -f "${uninstallScript}" ]; then | ||
"${uninstallScript}" | ||
fi | ||
} | ||
|
||
deployOneagentCtl() { | ||
local ONEAGENTCTL_DIR="${INSTALL_DIR}/agent/tools" | ||
mkdir -p "${ONEAGENTCTL_DIR}" | ||
mkdir -p "${DEPLOYMENT_CONF_PATH}" | ||
printf '%s' "${ONEAGENTCTL_CODE}" > "${ONEAGENTCTL_DIR}/${ONEAGENTCTL_BIN}" | ||
chmod +x "${ONEAGENTCTL_DIR}/${ONEAGENTCTL_BIN}" | ||
} | ||
|
||
deployUninstallScript() { | ||
local UNINSTALL_DIR="${INSTALL_DIR}/agent" | ||
mkdir -p "${UNINSTALL_DIR}" | ||
printf '%s' "${UNINSTALL_CODE}" > "${UNINSTALL_DIR}/${UNINSTALL_SCRIPT}" | ||
chmod +x "${UNINSTALL_DIR}/${UNINSTALL_SCRIPT}" | ||
} | ||
|
||
applyConfig() { | ||
"${INSTALL_DIR}/agent/tools/${ONEAGENTCTL_BIN}" ${CTL_PARAMS} | ||
} | ||
|
||
main() { | ||
parseParams "$@" | ||
uninstall | ||
deployOneagentCtl | ||
deployUninstallScript | ||
applyConfig | ||
} | ||
|
||
################## | ||
## SCRIPT START ## | ||
################## | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters