make needsrootforbuild / norootforbuild work
authorDr. Peter Poeml <poeml@cmdline.net>
Wed, 21 Mar 2007 00:27:26 +0000 (00:27 +0000)
committerDr. Peter Poeml <poeml@cmdline.net>
Wed, 21 Mar 2007 00:27:26 +0000 (00:27 +0000)
build

diff --git a/build b/build
index bf1ab9b..7859ee9 100755 (executable)
--- a/build
+++ b/build
@@ -646,14 +646,17 @@ for SPECFILE in $SPECFILES ; do
 
     #
     # check if we want to build with the abuild user
+    # build as root per default, unless option --norootforbuild was given
+    # override with "needsrootforbuild" or "norootforbuild" in the spec file
     #
     BUILD_USER=root
+    test -n "$NOROOTFORBUILD" && BUILD_USER=abuild
     if test "$BUILD_USER" = abuild ; then
        egrep '^#[       ]*needsrootforbuild[       ]*$' >/dev/null <$SPECFILE && BUILD_USER=root
     else
        egrep '^#[       ]*norootforbuild[       ]*$' >/dev/null <$SPECFILE && BUILD_USER=abuild
     fi
-    test -n "$NOROOTFORBUILD" && BUILD_USER=abuild
+
     if test $BUILD_USER = abuild ; then
         if ! egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then
             echo 'abuild::99:99:Autobuild:/home/abuild:/bin/bash' >>$BUILD_ROOT/etc/passwd