From 1314b3942d183c43f6d7cd8e069579b2a3c0616f Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 1 Jan 2016 21:37:42 -0500 Subject: [PATCH] Correctly handle dokku-installer init file creation on systemd instances - Use the nginx.conf file's existence as a check for whether we should start the service or not - Create the init files with the dokku-installer.py file. This adds actual systemd support. - Also ensure we *always* start the service, regardless of it's status. This fixes an issue with processing systemd output --- debian/postinst | 10 +++++++--- debian/preinst | 6 ------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/debian/postinst b/debian/postinst index 8e64bc19d..ac206d54d 100755 --- a/debian/postinst +++ b/debian/postinst @@ -51,9 +51,13 @@ case "$1" in rm -f ${DOKKU_ROOT}/VERSION cp ${DOKKU_LIB_ROOT}/STABLE_VERSION ${DOKKU_ROOT}/VERSION - echo "starting dokku-installer if necessary" - if [ -f /etc/init/dokku-installer.conf ] && service dokku-installer status 2> /dev/null | grep waiting; then - sudo service dokku-installer start + if [[ -f /etc/nginx/conf.d/dokku-installer.conf ]]; then + echo "Setting up dokku-installer" + /usr/local/share/dokku/contrib/dokku-installer.py onboot + + echo "Starting dokku-installer" + [[ -f /etc/systemd/system ]] && systemctl daemon-reload + service dokku-installer start fi db_get "dokku/web_config" diff --git a/debian/preinst b/debian/preinst index 65f04f69c..9efc00b1b 100755 --- a/debian/preinst +++ b/debian/preinst @@ -7,14 +7,8 @@ case "$1" in install) db_get "dokku/web_config" if [ "$RET" = "true" ]; then - INIT_CONF="/etc/init/dokku-installer.conf" NGINX_CONF="/etc/nginx/conf.d/dokku-installer.conf" - rm -f $INIT_CONF - touch $INIT_CONF - echo 'start on runlevel [2345]' >> $INIT_CONF - echo 'exec /usr/local/share/dokku/contrib/dokku-installer.py selfdestruct' >> $INIT_CONF - rm -f $NGINX_CONF touch $NGINX_CONF