authentic/debian/authentic2.postinst

64 lines
1.5 KiB
Bash

#!/bin/sh
#
# Postinst script for authentic2
#
set -e
AUTHENTIC_USER=authentic
AUTHENTIC_GROUP=authentic
AUTHENTIC_HOME=/var/lib/authentic
case "$1" in
configure)
if ! getent group $AUTHENTIC_GROUP > /dev/null 2>&1; then
echo -n "Adding group $AUTHENTIC_GROUP.."
addgroup --quiet --system $AUTHENTIC_GROUP
echo "..done"
fi
if ! getent passwd $AUTHENTIC_USER > /dev/null 2>&1; then
echo -n "Adding user $AUTHENTIC_USER.."
adduser --quiet --system --gecos "Pootle daemon" \
--ingroup $AUTHENTIC_GROUP \
--no-create-home --home $AUTHENTIC_HOME \
$AUTHENTIC_USER
echo "..done"
fi
chown $AUTHENTIC_USER:$AUTHENTIC_GROUP /var/lib/authentic2
/usr/bin/authentic2-ctl collectstatic --noinput --link
/usr/bin/authentic2-ctl compilemessages
;;
reconfigure)
/usr/bin/authentic2-ctl collectstatic --noinput --link
/usr/bin/authentic2-ctl compilemessages
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
case "$1" in
configure)
if [ -z "$2" ]; then
su authentic -p -c "django-admin syncdb --settings authentic2.settings --noinput"
fi
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0