X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=build_devel.sh;h=4b8febb63039e74b1bb87c6907fa7861b0edf743;hb=e5acac6d6e8118faab76ac73cb2b8b10d89dd086;hp=5ad3e032c9c41d6adc542ea43b0f479f6eb731e6;hpb=77d434bbaa709690b42ffa9ecf2777661f612d3a;p=myplc.git diff --git a/build_devel.sh b/build_devel.sh index 5ad3e03..4b8febb 100755 --- a/build_devel.sh +++ b/build_devel.sh @@ -10,42 +10,36 @@ # devel/data/cvs/ (local CVS repository) # devel/data/build/ (build area) # devel/data/etc/planetlab/ (configuration) +# devel/data/root (root's home dir) # # Mark Huang -# Copyright (C) 2006 The Trustees of Princeton University +# Marc E. Fiuczynski +# Copyright (C) 2006-2007 The Trustees of Princeton University # -# $Id: build_devel.sh,v 1.3 2006/08/09 21:38:06 mlhuang Exp $ +# $Id:$ # . build.functions +# These directories are allowed to grow to unspecified size, so they +# are stored as symlinks to the /data partition. mkfedora and yum +# expect some of them to be real directories, however. +datadirs=( +/etc/planetlab +/root +/tmp +/usr/tmp +/var/tmp +/var/log +) + +pl_fixdirs devel/root "${datadirs[@]}" + + 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 @@ -64,13 +58,37 @@ 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' +# 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 sh -c "groupadd -o -g $gid build; \ +useradd -o -c 'Automated Build' -u $uid -g $gid -n -d /data/build -M -s /bin/bash build; \ +exit 0" +fi + +# Copy build scripts to build home directory +mkdir -p devel/data/build +rsync -a $srcdir/build/ devel/data/build/ + +# Allow build user to build certain RPMs as root +cat >devel/root/etc/sudoers <