Skip to content

Commit

Permalink
fix after-install script systemd init (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
blockloop authored Jan 14, 2019
1 parent e0ecd80 commit b16e6e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 4 additions & 5 deletions packaging/scripts/after_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ patch_updates() {
EOF

chmod a+x "${CRON}"

echo "cron installed"
}

init_systemd() {
systemctl stop ${SVC_NAME} || true
rm -fv ${SYSTEMD_SVC_FILE}
systemctl stop "${SYSTEMD_SVC_FILE}" || true
# --now is unsupported on older versions of debian/systemd
systemctl disable "${SYSTEMD_SVC_FILE}" || true
# cannot use symlink because of an old bug https://bugzilla.redhat.com/show_bug.cgi?id=955379
cat <<-EOF > "${SYSTEMD_SVC_FILE}"
[Unit]
Expand All @@ -92,7 +91,7 @@ init_systemd() {
WantedBy=multi-user.target
EOF

# enable --now is unsupported on older versions of debian/systemd
# --now is unsupported on older versions of debian/systemd
systemctl enable ${SYSTEMD_SVC_FILE}
systemctl start ${SVC_NAME}
}
Expand Down
8 changes: 5 additions & 3 deletions scripts/uat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ SNYDER_SSH_FINGERPRINT="47:31:9b:8b:87:a7:2d:26:79:17:87:83:53:65:d4:b4"
# shellcheck disable=SC1117
USER_DATA_DEB="#!/usr/bin/env bash \n\
[ -z \`command -v curl\` ] && apt-get -qq update && apt-get install -q -y curl \n\
curl -sL https://insights.nyc3.cdn.digitaloceanspaces.com/do-agent-install.sh | sudo bash"
curl -sL https://insights.nyc3.cdn.digitaloceanspaces.com/install.sh | sudo bash"

# shellcheck disable=SC1117
USER_DATA_RPM="#!/usr/bin/env bash \n\
[ -z \`command -v curl\` ] && yum -y install curl \n\
curl -sL https://insights.nyc3.cdn.digitaloceanspaces.com/do-agent-install.sh | sudo bash"
curl -sL https://insights.nyc3.cdn.digitaloceanspaces.com/install.sh | sudo bash"


function main() {
Expand Down Expand Up @@ -142,7 +142,9 @@ function command_status() {
# ssh to all droplets and run yum/apt update to upgrade to the latest published
# version of do-agent
function command_update() {
command_exec "/bin/bash /opt/digitalocean/do-agent/scripts/update.sh"
exec_rpm "yum -q -y update do-agent"
exec_deb "apt-get -qq update"
exec_deb "apt-get -qq install --only-upgrade do-agent"
}

# ssh to all droplets and execute a command
Expand Down

0 comments on commit b16e6e8

Please sign in to comment.