[debian-edu-commits] debian-edu/ 20/32: debian/italc-client.prerm: On package purgal, only remove groups if we previously explicitly created them as iTALC roles.

Mike Gabriel sunweaver at debian.org
Mon Aug 18 15:09:46 UTC 2014


This is an automated email from the git hooks/post-receive script.

sunweaver pushed a commit to annotated tag debian/1_2.0.2+dfsg1-1
in repository italc.

commit 11e83b9d6512fb204f78be4c27c8231c78e378a3
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Aug 15 13:33:38 2014 +0200

    debian/italc-client.prerm: On package purgal, only remove groups if we previously explicitly created them as iTALC roles.
---
 debian/italc-client.prerm | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/debian/italc-client.prerm b/debian/italc-client.prerm
index 5527384..a1582f6 100755
--- a/debian/italc-client.prerm
+++ b/debian/italc-client.prerm
@@ -25,14 +25,28 @@ case "$1" in
 		if dpkg-statoverride --list /usr/bin/italc_auth_helper >/dev/null; then
 			dpkg-statoverride --remove /usr/bin/italc_auth_helper
 		fi
-		for role in admin supporter teacher student; do
-			db_get italc-client/group-italc-$role
-			group=$(echo $RET | cut -d" " -f1)
-			if echo "$group" | egrep -v '^[[:digit:]]{1,5}$' 1>/dev/null; then
-				getent group $group 1>/dev/null && delgroup $group && [ `id $group` -ge 100 ] || \
-				    echo "Failed to remove group »$group« from the system."
-			fi
-		done
+
+		db_get italc-client/use-existing-groups-for-roles || true
+		use_existing=$RET
+		db_get italc-client/create-groups-for-roles || true
+		create_groups=$RET
+
+		# only if we previously created iTALC's role-groups, we remove them on package purgal...
+		if [ "$use_existing" = "false" ] && [ "$create_groups" = "true" ]; then
+			for role in admin supporter teacher student; do
+
+				db_get italc-client/group-italc-$role || true
+				group=$(echo $RET | cut -d" " -f1)
+
+				if echo "$group" | egrep -v '^[[:digit:]]{1,5}$' 1>/dev/null; then
+
+					# only attempt removal of non-system groups that actually exist...
+					if getent group $group 1>/dev/null && [ $(getent group $group | cut -d ":" -f3) -ge 100 ]; then
+						delgroup $group 1>/dev/null
+					fi
+				fi
+			done
+		fi
 		;;
 	deconfigure|upgrade|failed-upgrade)
 		:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/italc.git



More information about the debian-edu-commits mailing list