From 5a74d5c2477bd78fb59ed3b38fe546b122036924 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 2 Jan 2016 04:08:54 -0500 Subject: [PATCH] Create the proper init file in a distribution-agnostic way From http://unix.stackexchange.com/a/164092/105389 --- plugins/00_dokku-standard/install | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/plugins/00_dokku-standard/install b/plugins/00_dokku-standard/install index 5e999582c..636145dfa 100755 --- a/plugins/00_dokku-standard/install +++ b/plugins/00_dokku-standard/install @@ -11,9 +11,8 @@ fi # temporary hack for https://github.com/dokku/dokku/issues/82 # redeploys all apps after a reboot -case "$DOKKU_DISTRO" in - ubuntu) - cat< /etc/init/dokku-redeploy.conf +if [[ $(/sbin/init --version 2> /dev/null) =~ upstart ]]; then + cat< /etc/init/dokku-redeploy.conf description "Dokku app redeploy service" start on filesystem and started docker @@ -23,10 +22,10 @@ script sudo -i -u dokku /usr/local/bin/dokku ps:restore end script EOF - ;; +fi - debian|opensuse) - cat< /etc/systemd/system/dokku-redeploy.service +if [[ $(systemctl 2> /dev/null) =~ -\.mount ]]; then + cat< /etc/systemd/system/dokku-redeploy.service [Unit] Description=Dokku app redeploy service After=docker.target @@ -39,11 +38,10 @@ ExecStart=/usr/local/bin/dokku ps:restore [Install] WantedBy=multi-user.target EOF - if command -v systemctl &>/dev/null; then - systemctl enable dokku-redeploy - fi - ;; -esac + if command -v systemctl &>/dev/null; then + systemctl enable dokku-redeploy + fi +fi mkdir -p /etc/update-motd.d cat< /etc/update-motd.d/99-dokku