Update uid/gid of build root if uid/gid is not match master release-for-gbsV0.13
authorZhang Qiang <qiang.z.zhang@intel.com>
Tue, 22 Jan 2013 20:49:36 +0000 (15:49 -0500)
committerZhang Qiang <qiang.z.zhang@intel.com>
Wed, 23 Jan 2013 18:41:56 +0000 (13:41 -0500)
This is very important for sharing build root to other developers,
and create a full build root for using by all developer.

Change-Id: I1edd3830a499cff7ab357d17484075e46bd8319b

build

diff --git a/build b/build
index 6169b26..1e91851 100755 (executable)
--- a/build
+++ b/build
@@ -1981,13 +1981,11 @@ for SPECFILE in "${SPECFILES[@]}" ; do
            chown "$ABUILD_UID:$ABUILD_GID" $BUILD_ROOT/home/abuild
        else
            if ! egrep "^abuild:x?:${ABUILD_UID}:${ABUILD_GID}" >/dev/null <$BUILD_ROOT/etc/passwd ; then
-               echo "abuild user present in the buildroot ($BUILD_ROOT) but uid:gid does not match"
-               echo "buildroot currently using:"
-               egrep "^abuild:" <$BUILD_ROOT/etc/passwd
-               echo "build script attempting to use:"
-               echo "abuild::${ABUILD_UID}:${ABUILD_GID}:..."
-               echo "build aborting"
-               cleanup_and_exit 1
+                sed -i '/^abuild:/d' $BUILD_ROOT/etc/passwd
+                sed -i '/^abuild:/d' $BUILD_ROOT/etc/group
+                echo "abuild:x:${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>$BUILD_ROOT/etc/passwd
+                echo "abuild:x:${ABUILD_GID}:" >>$BUILD_ROOT/etc/group
+                chown "$ABUILD_UID:$ABUILD_GID" $BUILD_ROOT/home/abuild -R
            fi
        fi
        if test -f $BUILD_ROOT/etc/shadow ; then