fargo/debian/fargo.postinst

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.1 KiB
Plaintext
Raw Normal View History

2015-08-18 16:09:48 +02:00
#! /bin/sh
2015-03-05 23:46:47 +01:00
set -e
2015-08-18 16:09:48 +02:00
NAME="fargo"
2015-04-10 17:05:55 +02:00
USER=$NAME
GROUP=$NAME
CONFIG_DIR="/etc/$NAME"
MANAGE_SCRIPT="/usr/bin/$NAME-manage"
2015-03-05 23:46:47 +01:00
case "$1" in
2015-08-18 16:09:48 +02:00
configure)
# make sure the administrative user exists
if ! getent passwd $USER >/dev/null; then
adduser --disabled-password --quiet --system \
--no-create-home --home /var/lib/$NAME \
--gecos "$NAME user" --group $USER
fi
# ensure dirs ownership
chown $USER:$GROUP /var/log/$NAME
chown $USER:$GROUP /var/lib/$NAME/collectstatic
2021-07-13 15:24:55 +02:00
chown $USER:$GROUP /var/lib/$NAME/spooler
2015-08-18 16:09:48 +02:00
chown $USER:$GROUP /var/lib/$NAME/tenants
# create a secret file
SECRET_FILE=$CONFIG_DIR/secret
if [ ! -f $SECRET_FILE ]; then
echo -n "Generating Django secret..." >&2
cat /dev/urandom | tr -dc [:alnum:]-_\!\%\^:\; | head -c70 > $SECRET_FILE
chown root:$GROUP $SECRET_FILE
chmod 0440 $SECRET_FILE
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
triggered)
su -s /bin/sh -c "$MANAGE_SCRIPT hobo_deploy --redeploy" $USER
;;
2015-08-18 16:09:48 +02:00
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
2015-03-05 23:46:47 +01:00
esac
#DEBHELPER#
exit 0