From 48d9b569689392c5a24f79cf31279118297ae6d5 Mon Sep 17 00:00:00 2001 From: kraai Date: Mon, 3 Oct 2005 13:57:43 +0000 Subject: Don't add a redundant group, passwd, and shadow entries for the build user. --- pbuilder-buildpackage-funcs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'pbuilder-buildpackage-funcs') diff --git a/pbuilder-buildpackage-funcs b/pbuilder-buildpackage-funcs index 093e053..fb888e8 100644 --- a/pbuilder-buildpackage-funcs +++ b/pbuilder-buildpackage-funcs @@ -81,10 +81,18 @@ function cowprotect () { function createbuilduser () { # create the build user if [ -n "$SUTOUSER" ]; then - cowprotect $BUILDPLACE/etc/passwd $BUILDPLACE/etc/group $BUILDPLACE/etc/shadow - echo "$BUILDUSERNAME:x:$BUILDUSERID:$BUILDUSERID:,,,:/tmp/buildd:/bin/sh" >> $BUILDPLACE/etc/passwd - echo "$BUILDUSERNAME:*:$BUILDUSERID:" >> $BUILDPLACE/etc/group - echo "$BUILDUSERNAME:!:::::::" >> $BUILDPLACE/etc/shadow + if ! grep -q ^$BUILDUSERNAME: $BUILDPLACE/etc/passwd; then + cowprotect $BUILDPLACE/etc/passwd + echo "$BUILDUSERNAME:x:$BUILDUSERID:$BUILDUSERID:,,,:/tmp/buildd:/bin/sh" >> $BUILDPLACE/etc/passwd + fi + if ! grep -q ^$BUILDUSERNAME: $BUILDPLACE/etc/group; then + cowprotect $BUILDPLACE/etc/group + echo "$BUILDUSERNAME:*:$BUILDUSERID:" >> $BUILDPLACE/etc/group + fi + if ! grep -q ^$BUILDUSERNAME: $BUILDPLACE/etc/shadow; then + cowprotect $BUILDPLACE/etc/shadow + echo "$BUILDUSERNAME:!:::::::" >> $BUILDPLACE/etc/shadow + fi unset LOGNAME || true else unset LOGNAME || true -- cgit v1.2.3