This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
amue-authentic2/debian/amue-authentic2.postinst

59 lines
1.7 KiB
Bash

#!/bin/sh
# postinst maintainer script for foo-pgsql
USER=amue-authentic2
GROUP=amue-authentic2
case "$1" in
configure)
if ! getent group $GROUP > /dev/null 2>&1; then
echo -n "Adding group $GROUP.."
addgroup --quiet --system $GROUP
echo "..done"
fi
if ! getent passwd $USER >/dev/null; then
echo Adding user $USER...
adduser --quiet --system --gecos "AMUE authentic2 system user" \
--ingroup $GROUP \
--no-create-home \
--home /var/lib/amue-authentic2 --shell /usr/sbin/nologin $USER
fi
mkdir -p /var/log/amue-authentic2
chown amue-authentic2 /var/log/amue-authentic2
;;
esac
# source debconf stuff
. /usr/share/debconf/confmodule
# source dbconfig-common shell library, and call the hook function
if [ -f /usr/share/dbconfig-common/dpkg/postinst.pgsql ]; then
. /usr/share/dbconfig-common/dpkg/postinst.pgsql
dbc_pgsql_createdb_encoding="UTF8"
dbc_generate_include=template:/etc/amue-authentic2/db.conf
dbc_generate_include_args="-o template_infile=/usr/share/amue-authentic2/templates/db.conf -U"
dbc_generate_include_owner="amue-authentic2"
dbc_generate_include_perms="640"
dbc_go amue-authentic2 $@
fi
case "$1" in
configure)
echo Updating static files...
/usr/lib/amue-authentic2/manage.sh collectstatic --noinput
if [ ! -e /etc/nginx/sites-enabled/idp.amue.fr ]; then
echo Installing nginx virtualhost...
ln -s /etc/nginx/sites-available/idp.amue.fr /etc/nginx/sites-enabled/
invoke-rc.d nginx restart
else
echo Reloading nginx virtualhost...
invoke-rc.d nginx reload
fi
echo Restarting amue-authentic...
/usr/bin/supervisorctl update
/usr/bin/supervisorctl restart amue-authentic2
;;
esac
#DEBHELPER#