| Server IP : 192.241.186.36 / Your IP : 216.73.216.164 Web Server : Apache/2.4.29 (Ubuntu) System : Linux webserver7 4.15.0-194-generic #205-Ubuntu SMP Fri Sep 16 19:49:27 UTC 2022 x86_64 User : root ( 0) PHP Version : 7.4.32 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/lib/dpkg/info/ |
Upload File : |
#!/bin/sh
# vim: noexpandtab
set -ue
SVC_NAME=droplet-agent
UPDATE_TIMER=${SVC_NAME}-update.timer
INSTALL_RETRY_TIMER=${SVC_NAME}-install-retry.timer
INSTALL_RETRY_SERVICE=${SVC_NAME}-install-retry.service
INSTALL_RETRY_DIR=/var/lib/digitalocean/droplet-agent-install
LEGACY_INIT_SVC_FILE="/etc/init/${SVC_NAME}.conf"
LEGACY_CRON=/etc/cron.hourly/${SVC_NAME}
LEGACY_RETRY_CRON=/etc/cron.hourly/droplet-agent-install
# fix an issue where this script runs on upgrades for rpm
# see https://github.com/jordansissel/fpm/issues/1175#issuecomment-240086016
arg="${1:-0}"
main() {
if echo "${arg}" | grep -qP '^\d+$' && [ "${arg}" -gt 0 ]; then
# rpm upgrade
exit 0
elif echo "${arg}" | grep -qP '^upgrade$'; then
# deb upgrade
exit 0
fi
if command -v systemctl >/dev/null 2>&1; then
clean_systemd
else
echo "Unknown init system" > /dev/stderr
fi
remove_legacy_cron
rm -f "${LEGACY_INIT_SVC_FILE}"
}
clean_systemd() {
echo "Cleaning up systemd scripts"
systemctl stop "${UPDATE_TIMER}" || true
systemctl disable "${UPDATE_TIMER}" || true
systemctl stop "${INSTALL_RETRY_TIMER}" >/dev/null 2>&1 || true
systemctl disable "${INSTALL_RETRY_TIMER}" >/dev/null 2>&1 || true
systemctl stop ${SVC_NAME} || true
systemctl disable ${SVC_NAME}.service || true
systemctl daemon-reload || true
rm -f \
"/etc/systemd/system/${INSTALL_RETRY_TIMER}" \
"/etc/systemd/system/${INSTALL_RETRY_SERVICE}" \
"${INSTALL_RETRY_DIR}/retry_install.sh"
}
remove_legacy_cron() {
rm -f "${LEGACY_CRON}"
rm -f "${LEGACY_RETRY_CRON}"
}
main