X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=build.sh;h=e777822afd83449fecff5d967d7a7d431abb2e47;hb=8fae2ed4389711dc8e76824ecb86aa5c94e101b3;hp=d2708070082c2190a777eb0c369de0c67d345173;hpb=d7cb7b8b1144544b5c3ba0777f02c6e97209b7ba;p=vserver-reference.git diff --git a/build.sh b/build.sh index d270807..e777822 100755 --- a/build.sh +++ b/build.sh @@ -1,129 +1,102 @@ #!/bin/bash # -# Builds VServer reference image. Requires the web and boot servers to -# be up, which complicates bootstrap. Alternatively, we could require -# the build server to host a local yum repository. Already, it is -# required to run the same major version of yum as the nodes. +# Builds all reference image for vservers. To optimize for space it +# will only build a complete base vserver reference image and then +# builds "stub" images that are just contain the additional files +# and/or changes for a given reference image. This is done to shrink +# the RPM itself. These will be pieced back together with the base +# vserver reference image by an init script that is installed on the +# node. # # Mark Huang -# Copyright (C) 2004-2005 The Trustees of Princeton University +# Marc E. Fiuczynski +# Copyright (C) 2004-2007 The Trustees of Princeton University # -# $Id: vserver-reference.init,v 1.17 2005/09/02 19:46:37 mlhuang Exp $ +# $Id: build.sh,v 1.20 2007/09/06 20:41:23 faiyaza Exp $ # -# Get the production /etc/yum.conf file. XXX When MAs begin deploying -# their own boot servers and/or code, this will have to change. -curl --silent http://boot.planet-lab.org/$(curl --silent --insecure --form node_id=0 --form file=/etc/yum.conf https://boot.planet-lab.org/db/plnodeconf/getsinglefile.php) > yum.conf - -# Solve the bootstrap problem by including any just built packages in -# the yum configuration. This cooperates with the PlanetLab build -# system. -if [ -n "$RPM_BUILD_DIR" ] ; then - # Remove any [PlanetLab*] sections - sed -i -f - yum.conf <> yum.conf < $VROOT/etc/fstab < $VROOT/etc/rpm/macros < ${vdir}.cloned + + # Construct the excludes & includes patterns for rsync + (cd ${vdir} && find *) > ${vdir}.excludes + echo "var/lib/rpm/*" > ${vdir}.includes + + # Install the system vserver specific packages + [ -n "$systempackages" ] && yum -c ${vdir}/etc/yum.conf --installroot=${vdir} -y install $systempackages + [ -n "$systemgroups" ] && yum -c ${vdir}/etc/yum.conf --installroot=${vdir} -y groupinstall $systemgroups + + # Create a copy of the system vserver w/o the vserver reference files + mkdir -p ${vdir}-tmp/ + rsync -a --include-from=${vdir}.includes --exclude-from=${vdir}.excludes ${vdir}/ ${vdir}-tmp/ + rm -rf ${vdir} + rm -f ${vdir}.excludes ${vdir}.includes + mv ${vdir}-tmp ${vdir} +done exit 0