[SCM] icecast2/master: Tidy user+group creation and removal.

js at users.alioth.debian.org js at users.alioth.debian.org
Tue Mar 8 00:41:39 UTC 2011


The following commit has been merged in the master branch:
commit baf67ba577dc16f3fb8d2d0886af9cc6fb0d7047
Author: Jonas Smedegaard <dr at jones.dk>
Date:   Tue Mar 8 01:41:36 2011 +0100

    Tidy user+group creation and removal.

diff --git a/debian/icecast2.postinst b/debian/icecast2.postinst
index 76edf82..ca9a341 100644
--- a/debian/icecast2.postinst
+++ b/debian/icecast2.postinst
@@ -28,16 +28,11 @@ if [ -f /etc/icecast.xml ] && grep -q /etc/icecast2/ /etc/default/icecast2; then
     echo "See /usr/share/doc/icecast2/examples for new configuration options."
 fi
 
-if ! getent group icecast >/dev/null 2>&1; then
-    addgroup --system icecast
-fi
-
-# Check for an account named 'icecast2'
-if ! id icecast2 >/dev/null 2>&1; then
-    # Create the new system account
-    adduser --system --disabled-password --disabled-login \
+getent group icecast >/dev/null 2>&1 || \
+	addgroup --system --quiet icecast
+id icecast2 >/dev/null 2>&1 || \
+	adduser --system --quiet --disabled-password --disabled-login \
 	--home /usr/share/icecast2 --no-create-home --ingroup icecast icecast2
-fi
 
 chown -R icecast2: /var/log/icecast2 /etc/icecast2
 # Set all file readable by default
diff --git a/debian/icecast2.postrm b/debian/icecast2.postrm
index 92fadba..b6656ca 100644
--- a/debian/icecast2.postrm
+++ b/debian/icecast2.postrm
@@ -6,19 +6,8 @@ set -e
 case "$1" in
     purge)
 	rm -rf /var/log/icecast2
-
-	if id icecast2 >/dev/null 2>&1; then
-		if which deluser > /dev/null; then
-			deluser icecast2
-		fi
-	fi
-
-	# Remove group only if empty
-	if getent group icecast | awk -F: ' { print $4 } ' | egrep -cq '^$'; then
-		if which groupdel > /dev/null; then
-			groupdel icecast || echo "Error occured removing group icecast, please do it manually."
-		fi
-	fi
+	deluser --system --quiet icecast2 || true
+	delgroup --system --quiet --only-if-empty icecast || true
 	;;
     remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
 

-- 
icecast2 packaging



More information about the pkg-multimedia-commits mailing list