From 3ca575c5d44de0214b54c63eb99ca0cbd8bbd13c Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Sat, 20 Jan 2007 04:02:43 +0000 Subject: [PATCH] - create a build user with the same uid/gid as the sudoer, if possible. Set its home directory to /data/build. - skip the whole cvs import garbage; too confusing and no one uses it --- build_devel.sh | 55 ++++++++++++++++++++------------------------------ 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/build_devel.sh b/build_devel.sh index e8bce85..f3da644 100755 --- a/build_devel.sh +++ b/build_devel.sh @@ -15,7 +15,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: build_devel.sh,v 1.6 2007/01/11 21:49:52 mlhuang Exp $ +# $Id: build_devel.sh,v 1.7 2007/01/12 14:48:02 mlhuang Exp $ # . build.functions @@ -25,8 +25,6 @@ # expect some of them to be real directories, however. datadirs=( /etc/planetlab -/build -/cvs /root /tmp /usr/tmp @@ -45,29 +43,6 @@ echo "* myplc-devel: Installing base filesystem" mkdir -p devel/root make_chroot devel/root plc_devel_config.xml -# Import everything (including ourself) into a private CVS tree -echo "* myplc-devel: Building CVS repository" -cvsroot=$PWD/devel/data/cvs -mkdir -p $cvsroot -cvs -d $cvsroot init - -myplc=$(basename $PWD) -pushd .. -for dir in * ; do - if [ ! -d $cvsroot/$dir ] ; then - pushd $dir - if [ "$dir" = "$myplc" ] ; then - # Ignore generated files - ignore="-I ! -I devel -I root -I root.img -I data" - else - ignore="-I !" - fi - cvs -d $cvsroot import -m "Initial import" -ko $ignore $dir planetlab $IMPORT_TAG - popd - fi -done -popd - # Install configuration file echo "* myplc-devel: Installing configuration file" install -D -m 444 plc_devel_config.xml devel/data/etc/planetlab/default_config.xml @@ -86,14 +61,28 @@ find plc.d/functions | cpio -p -d -u devel/root/etc/ install -D -m 755 guest.init devel/root/etc/init.d/plc chroot devel/root sh -c 'chkconfig --add plc; chkconfig plc on' -# handle root's homedir and tweak root prompt -echo "* myplc-devel: root's homedir and prompt" -roothome=devel/data/root -mkdir -p $roothome -cat << EOF > $roothome/.profile -export PS1=" \$PS1" +# Add a build user with the same ID as the current build user, who can +# then cross-mount their home directory into the image and build MyPLC +# in their home directory. +echo "* myplc-devel: Adding build user" +uid=${SUDO_UID:-2000} +gid=${SUDO_GID:-2000} +if ! grep -q "Automated Build" devel/root/etc/passwd ; then + chroot devel/root <devel/root/etc/sudoers <