aboutsummaryrefslogtreecommitdiff
path: root/pbuilder-buildpackage-funcs
diff options
context:
space:
mode:
Diffstat (limited to 'pbuilder-buildpackage-funcs')
-rw-r--r--pbuilder-buildpackage-funcs16
1 files changed, 12 insertions, 4 deletions
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