Files
dokku/debian/preinst
Jose Diaz-Gonzalez 86795ddacc tests: run mvdan/shfmt on test runs
While I do not agree with _every_ style change, this will force Dokku to have consistent formatting across all shell scripts, which is arguably a Good Thing™.

The command used to reprocess everything is:

```shell
shfmt -l -bn -ci -i 2 -w .
```
2019-01-07 01:25:55 -05:00

72 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
set -eo pipefail
[[ $TRACE ]] && set -x
if [[ -e /usr/share/debconf/confmodule ]]; then
# shellcheck disable=SC1091
. /usr/share/debconf/confmodule
fi
case "$1" in
install)
db_get "dokku/web_config"
if [ "$RET" = "true" ]; then
NGINX_CONF="/etc/nginx/conf.d/dokku-installer.conf"
rm -f $NGINX_CONF
touch $NGINX_CONF
{
echo 'upstream dokku-installer { server 127.0.0.1:2000; }'
echo 'server {'
echo ' listen 80;'
echo ' location / {'
echo ' proxy_pass http://dokku-installer;'
echo ' }'
echo '}'
} >>$NGINX_CONF
rm -f /etc/nginx/sites-enabled/*
DOKKU_DISTRO="$(
. /etc/os-release >/dev/null 2>&1 || true
echo "$ID"
)"
case "$DOKKU_DISTRO" in
debian)
NGINX_INIT="/usr/sbin/invoke-rc.d"
"$NGINX_INIT" nginx reload || "$NGINX_INIT" nginx start
;;
ubuntu)
NGINX_INIT="/etc/init.d/nginx"
"$NGINX_INIT" reload || "$NGINX_INIT" start
;;
esac
exit 0
fi
db_get "dokku/skip_key_file"
if [ -z "${DEBCONF_RECONFIGURE}" ] && [ "$RET" != "true" ]; then
db_get "dokku/key_file"
if [ ! -f "$RET" ]; then
echo "Error: keyfile '$RET' not found."
echo " you can enter a new keyfile path when you restart the installation."
db_reset "dokku/key_file"
exit 1
fi
fi
;;
upgrade) ;;
\
abort-upgrade) ;;
\
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0