authentic/debian/authentic2.postinst

65 lines
1.6 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
mkdir -p /var/lib/authentic2
chmod 755 /var/lib/authentic2
chown $AUTHENTIC_USER:$AUTHENTIC_GROUP /var/lib/authentic2
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
rm -f /var/lib/pycentral/authentic2.pkgremove
if which pycentral >/dev/null 2>&1; then
pycentral pkginstall authentic2
if grep -qs '^authentic2$' /var/lib/pycentral/delayed-pkgs; then
sed -i '/^authentic2$/d' /var/lib/pycentral/delayed-pkgs
fi
fi
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