Files
dokku/debian/preinst
Jose Diaz-Gonzalez 3fdc1d20b6 Only start the dokku-installer if it's not already running
Upgrades from previous - fresh - dokku versions will fail if the dokku-installer is already running.
2015-01-16 16:52:50 -05:00

38 lines
958 B
Bash
Executable File

#!/bin/sh
set -e
case "$1" in
install)
INIT_CONF="/etc/init/dokku-installer.conf"
NGINX_CONF="/etc/nginx/conf.d/dokku-installer.conf"
touch $INIT_CONF
echo 'start on runlevel [2345]' >> $INIT_CONF
echo 'exec /root/dokku/contrib/dokku-installer.rb selfdestruct' >> $INIT_CONF
touch $NGINX_CONF
echo 'upstream dokku-installer { server 127.0.0.1:2000; }' >> $NGINX_CONF
echo 'server {' >> $NGINX_CONF
echo ' listen 80;' >> $NGINX_CONF
echo ' location / {' >> $NGINX_CONF
echo ' proxy_pass http://dokku-installer;' >> $NGINX_CONF
echo ' }' >> $NGINX_CONF
echo '}' >> $NGINX_CONF
rm -f /etc/nginx/sites-enabled/*
service nginx reload
if service dokku-installer status 2> /dev/null | grep waiting; then
sudo service dokku-installer start
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0