From 0c81d519b767fce49387f7f20d6dc6f9660649f2 Mon Sep 17 00:00:00 2001
From: kytv <kytv@mail.i2p>
Date: Sat, 7 Jan 2012 00:20:43 +0000
Subject: [PATCH] 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.
---
 debian/changelog    | 13 +++++++++----
 debian/i2p.postinst |  5 +++--
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0148908a15..9956396109 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,16 @@
-i2p (0.8.12-1) stable; urgency=medium
+i2p (0.8.12-2) stable; urgency=low
+
+  * postinst: Don't fail if the i2psvc group doesn't exist
+
+ -- Kill Your TV <killyourtv@i2pmail.org>  Fri, 06 Jan 2012 18:43:09 +0000
+
+i2p (0.8.12-1) stable; urgency=low
 
   * New upstream I2P release
   * Debconf:
     - add wrapper.java.maxmemory from wrapper.config
     - The warning about the daemon user needing to exist was confusing to some
-      that assumed this meant that i2psvc had to exist. This warning has been
+      that assumed this meant that i2psvc had to exit. This warning has been
       clarified.
     - Spanish, Swedish, Ukrainian translation updates
   * Initscript changes/fixes:
@@ -13,14 +19,13 @@ i2p (0.8.12-1) stable; urgency=medium
       wrapper versions)
     - move I2PTEMP to /tmp/i2p-daemon
     - move router.ping to /var/run/i2p
-    - chown /var/log/i2p to i2psvc:i2psvc instead of i2psvc:adm
     - various other clean-ups
     - explicity redirect errors to stderr
   * maintainer scripts:
     - postinst: rewrite the handling of an existing i2psvc account
     - postrm: remove /etc/default/i2p if the package is purged
 
- -- Kill Your TV <killyourtv@i2pmail.org>  Thu, 05 Jan 2012 00:00:00 +0000
+ -- Kill Your TV <killyourtv@i2pmail.org>  Fri, 06 Jan 2012 02:49:03 +0000
 
 i2p (0.8.11-2) stable; urgency=medium
 
diff --git a/debian/i2p.postinst b/debian/i2p.postinst
index 7d4f072902..a01b7107ce 100755
--- a/debian/i2p.postinst
+++ b/debian/i2p.postinst
@@ -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
-- 
GitLab