2016-01-01 21:45:38 -05:00
|
|
|
#!/bin/bash
|
2019-01-07 01:04:17 -05:00
|
|
|
set -eo pipefail
|
|
|
|
|
[[ $TRACE ]] && set -x
|
2016-01-01 21:45:38 -05:00
|
|
|
|
2016-06-09 12:48:54 -04:00
|
|
|
if [[ -e /usr/share/debconf/confmodule ]]; then
|
|
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
|
fi
|
|
|
|
|
|
2016-01-02 02:52:30 -05:00
|
|
|
readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}"
|
|
|
|
|
readonly DOKKU_LIB_ROOT="${DOKKU_LIB_PATH:-/var/lib/dokku}"
|
2016-06-26 16:56:14 -04:00
|
|
|
readonly DOKKU_LOGS_DIR="${DOKKU_LOGS_DIR:="/var/log/dokku"}"
|
2016-01-02 02:52:30 -05:00
|
|
|
|
|
|
|
|
main() {
|
2016-12-28 07:32:19 +02:00
|
|
|
if [[ -f /etc/systemd/system/dokku-installer.service ]] || [[ -f /etc/init/dokku-installer.conf ]]; then
|
2016-01-02 03:37:16 -05:00
|
|
|
service dokku-installer stop || true
|
|
|
|
|
fi
|
|
|
|
|
|
2016-01-02 02:52:30 -05:00
|
|
|
rm -f /etc/init/dokku-installer.conf
|
|
|
|
|
rm -f /etc/init/dokku-redeploy.conf
|
2016-12-28 07:32:19 +02:00
|
|
|
rm -f /etc/systemd/system/dokku-installer.service
|
2016-01-02 02:52:30 -05:00
|
|
|
rm -f /etc/systemd/system/dokku-redeploy.service
|
|
|
|
|
rm -f /etc/update-motd.d/99-dokku
|
|
|
|
|
|
2018-09-30 15:33:42 -04:00
|
|
|
db_get "dokku/nginx_enable"
|
|
|
|
|
if [ "$RET" = "true" ]; then
|
|
|
|
|
(nginx -t && service nginx reload) || true
|
|
|
|
|
fi
|
2016-01-02 03:37:44 -05:00
|
|
|
|
2016-01-02 02:52:30 -05:00
|
|
|
if [[ "$1" == "purge" ]]; then
|
2019-09-16 03:03:20 -04:00
|
|
|
rm -f /usr/local/openresty/nginx/conf/conf.d/dokku.conf
|
|
|
|
|
rm -f /usr/local/openresty/nginx/conf/conf.d/dokku-installer.conf
|
2018-01-23 23:21:30 -08:00
|
|
|
rm -f /etc/nginx/conf.d/dokku.conf
|
|
|
|
|
rm -f /etc/nginx/conf.d/dokku-installer.conf
|
2020-07-12 14:21:43 +01:00
|
|
|
rm -rf ${DOKKU_ROOT}/.dokkurc ${DOKKU_ROOT}/dokkurc ${DOKKU_ROOT}/tls
|
2016-01-02 02:52:30 -05:00
|
|
|
rm -f ${DOKKU_ROOT}/.ssh/authorized_keys ${DOKKU_ROOT}/.sshcommand
|
|
|
|
|
rm -f ${DOKKU_ROOT}/ENV ${DOKKU_ROOT}/HOSTNAME ${DOKKU_ROOT}/VERSION
|
|
|
|
|
rm -rf ${DOKKU_ROOT}/.cache
|
|
|
|
|
rm -rf ${DOKKU_LIB_ROOT}/core-plugins
|
|
|
|
|
|
|
|
|
|
rm -f ${DOKKU_LIB_ROOT}/plugins/config.toml
|
|
|
|
|
if [[ -d ${DOKKU_LIB_ROOT} ]]; then
|
|
|
|
|
find -L ${DOKKU_LIB_ROOT} -type l -delete
|
|
|
|
|
find ${DOKKU_LIB_ROOT} -type d -empty -delete
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ -d ${DOKKU_ROOT} ]]; then
|
|
|
|
|
find -L ${DOKKU_ROOT} -type l -delete
|
|
|
|
|
find ${DOKKU_ROOT} -type d -empty -delete
|
|
|
|
|
fi
|
|
|
|
|
|
2016-06-26 16:56:14 -04:00
|
|
|
rm -rf "${DOKKU_LOGS_DIR}"
|
|
|
|
|
|
|
|
|
|
deluser dokku || true
|
|
|
|
|
delgroup dokku || true
|
|
|
|
|
|
2016-06-09 12:48:54 -04:00
|
|
|
db_purge
|
2016-01-02 02:52:30 -05:00
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main "$@"
|