subscribe-list/debian/postinst

42 lines
1.3 KiB
Bash
Executable file

#!/bin/sh
set -e
case "$1" in
configure)
if ! getent group | grep -q "^www-data:"; then
echo -n "Adding group www-data.."
addgroup --quiet --system www-data 2>/dev/null || true
echo ".done"
fi
test -d /var/www || mkdir /var/www
if ! getent passwd | grep -q "^www-data:"; then
echo -n "Adding system user www-data.."
adduser --quiet --system --ingroup www-data --no-create-home --disabled-password www-data 2>/dev/null || true
echo ".done"
fi
usermod -c www-data -d /var/www -g www-data www-data
if ! test -d /var/lib/subscribe-list/; then
mkdir -m 750 /var/lib/subscribe-list/
touch /var/lib/subscribe-list/list.db
chmod 640 /var/lib/subscribe-list/list.db
chown -R www-data:www-data /var/lib/subscribe-list/
fi
if ! test -d /etc/subscribe-list/; then
mkdir -m 750 /etc/subscribe-list/
install -m 640 /usr/share/subscribe-list/config.toml.sample /etc/subscribe-list/config.toml
chown -R root:www-data /etc/subscribe-list/
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0