[debian-edu-commits] debian-edu/ 24/30: debian/educlient.{prerm, postinst}: Only fiddle with initial user account is present.

Mike Gabriel sunweaver at debian.org
Fri Oct 9 03:44:06 UTC 2015


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

sunweaver pushed a commit to branch multi-distro-support
in repository educlient.

commit b5f703997d999f89b051441b7ac33c51a39ce882
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Tue Aug 25 20:33:07 2015 +0200

    debian/educlient.{prerm,postinst}: Only fiddle with initial user account is present.
---
 debian/educlient.postinst | 16 +++++++++-------
 debian/educlient.prerm    | 16 +++++++++-------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/debian/educlient.postinst b/debian/educlient.postinst
index 528d530..26926d2 100755
--- a/debian/educlient.postinst
+++ b/debian/educlient.postinst
@@ -122,14 +122,16 @@ fi
 
 # Move UID and GID of the first local user to 500
 USERN="$(getent passwd 1000 | cut -d ":" -f 1)"
-HOME="$(getent passwd 1000 | cut -d ":" -f 6)"
-sed -i "s/:x:1000:1000:/:x:500:500/g" /etc/passwd
-sed -i "s/:x:1000/:x:500/g" /etc/group
-if which nscd 1>/dev/null; then
-    nscd -i passwd
-    nscd -i group
+if [ -n "${USERN}" ]; then
+	HOME="$(getent passwd 1000 | cut -d ":" -f 6)"
+	sed -i "s/:x:1000:1000:/:x:500:500/g" /etc/passwd
+	sed -i "s/:x:1000/:x:500/g" /etc/group
+	if which nscd 1>/dev/null; then
+	    nscd -i passwd
+	    nscd -i group
+	fi
+	chown -R $USERN:$USERN "$HOME"
 fi
-chown -R $USERN:$USERN "$HOME"
 
 echo "You really need to reboot NOW !!!"
 
diff --git a/debian/educlient.prerm b/debian/educlient.prerm
index f0bdfde..8c3220c 100755
--- a/debian/educlient.prerm
+++ b/debian/educlient.prerm
@@ -48,14 +48,16 @@ cat /etc/debian-edu/educlient.files-* | while read file;
 
 # Revert first user to UID and GID 1000
 USERN=$(getent passwd 500 | cut -d ":" -f 1)
-HOME=$(getent passwd 500 | cut -d ":" -f 6)
-sed "s/:x:500:500:/:x:1000:1000:/g" /etc/passwd
-sed "s/:x:500:/:x:1000:/g" /etc/group
-if which nscd 1>/dev/null; then
-	nscd -i passwd
-	nscd -i group
+if [ -n "$USERN" ]; then
+	HOME=$(getent passwd 500 | cut -d ":" -f 6)
+	sed "s/:x:500:500:/:x:1000:1000:/g" /etc/passwd
+	sed "s/:x:500:/:x:1000:/g" /etc/group
+	if which nscd 1>/dev/null; then
+		nscd -i passwd
+		nscd -i group
+	fi
+	chown -R $USERN:$USERN "$HOME"
 fi
-chown -R $USERN:$USERN "$HOME"
 
 #DEBHELPER#
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/upstream/educlient.git



More information about the debian-edu-commits mailing list