i2pd/debian/postinst

41 lines
977 B
Plaintext
Raw Normal View History

2015-12-16 13:22:55 +00:00
#!/bin/sh
2015-12-17 05:05:27 +00:00
set -e
2015-12-16 13:22:55 +00:00
LOGFILE='/var/log/i2pd/i2pd.log'
2015-12-16 13:22:55 +00:00
I2PDHOME='/var/lib/i2pd'
I2PDUSER='i2pd'
case "$1" in
configure|reconfigure)
# Older versions of adduser created the home directory.
# The version of adduser in Debian unstable does not.
# Create user and group as a system user.
2015-12-17 05:05:27 +00:00
if getent passwd $I2PDUSER > /dev/null 2>&1; then
2015-12-16 13:22:55 +00:00
groupadd -f $I2PDUSER || true
usermod -s "/bin/false" -e 1 $I2PDUSER > /dev/null || true
2015-12-17 05:05:27 +00:00
else
adduser --system --quiet --group --home $I2PDHOME $I2PDUSER
2015-12-16 13:22:55 +00:00
fi
mkdir -p -m0750 /var/log/i2pd
chown -f ${I2PDUSER}:adm /var/log/i2pd
2016-01-20 00:00:00 +00:00
touch $LOGFILE
chmod 640 $LOGFILE
chown -f ${I2PDUSER}:adm $LOGFILE
2015-12-16 13:22:55 +00:00
mkdir -p -m0750 $I2PDHOME
2015-12-17 05:05:27 +00:00
chown -f -R -P ${I2PDUSER}:${I2PDUSER} ${I2PDHOME}
2015-12-16 13:22:55 +00:00
;;
abort-upgrade|abort-remove|abort-deconfigure)
echo "Aborting upgrade"
exit 0
;;
*)
echo "postinst called with unknown argument '$1'" >&2
exit 0
;;
esac
#DEBHELPER#
exit 0