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.
compte-agglo-montpellier/debian/postinst

54 lines
1.4 KiB
Bash

#!/bin/sh
#
# Postinst script for compte-agglo-montpellier
#
set -e
USER=compte-agglo-montpellier
GROUP=compte-agglo-montpellier
HOME=/var/lib/compte-agglo-montpellier
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 2>&1; then
echo -n "Adding user $USER.."
adduser --quiet --system --gecos "Compte citoyen Montpellier daemon" \
--ingroup $GROUP \
--no-create-home --home $HOME \
$USER
echo "..done"
fi
chown $USER:$GROUP /var/lib/compte-agglo-montpellier /var/run/compte-agglo-montpellier /var/log/compte-agglo-montpellier
chown $USER:$GROUP /var/lib/compte-agglo-montpellier/static /var/lib/compte-agglo-montpellier/extra-static
chown $USER:$GROUP /var/lib/compte-agglo-montpellier/media
;;
reconfigure)
su compte-agglo-montpellier -p -c "/usr/bin/compte-agglo-montpellier collectstatic --noinput --link"
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0