Debian: Fix postinst script

On systems without an i2psvc group, the postinstall would fail. This change
will add the group if it doesn't exist. Also adding "||true" to the usermod
command in case the command returns a non-zero status.
This commit is contained in:
kytv
2012-01-07 00:20:43 +00:00
parent 5067499fa1
commit 0c81d519b7
2 changed files with 12 additions and 6 deletions

5
debian/i2p.postinst vendored
View File

@@ -63,14 +63,15 @@ case "$1" in
# Create user and group as a system user.
if getent passwd i2psvc > /dev/null 2>&1 ; then
groupadd -f $I2PSYSUSER || true
usermod -c "I2P Router Daemon" -d $I2PHOME -g $I2PSYSUSER -s "/bin/false" \
$I2PSYSUSER -e 1 > /dev/null 2>&1
$I2PSYSUSER -e 1 > /dev/null 2>&1 || true
else
adduser --system --quiet --group --home $I2PHOME $I2PSYSUSER
fi
[ -d /var/log/i2p ] || mkdir -m0750 /var/log/i2p
chown -f -R $I2PSYSUSER:adm /var/log/i2p
chown -f -R $I2PSYSUSER:i2psvc /var/log/i2p
# Has someone set the permissions with dpkg-statoverride? If so, obey them.
if ! dpkg-statoverride --list $I2PHOME > /dev/null 2>&1