-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-
-# In a normal CVS environment, the requisite CVS modules (including
-# build/) are located at the same level we are. In a PlanetLab RPM
-# build environment (see the RPM spec file), they are checked out into
-# a subdirectory.
-if [ -d ./build ] ; then
- PATH=$PATH:./build
- srcdir=.
-elif [ -d ../build ] ; then
- PATH=$PATH:../build
- srcdir=..
-else
- echo "Error: Could not find sources in either . or .."
- exit 1
-fi
-
-export PATH
-
-# PLC configuration file
-config=plc_config.xml
-
-# Release and architecture to install
-releasever=2
-basearch=i386
-
-# Data directory base
-usr_share=/usr/share
-
-# Initial size of the image
-size=1000000000
-
-usage()
-{
- echo "Usage: build.sh [OPTION]..."
- echo " -c file PLC configuration file (default: $config)"
- echo " -r release Fedora release number (default: $releasever)"
- echo " -a arch Fedora architecture (default: $basearch)"
- echo " -d datadir Data directory base (default: $usr_share)"
- echo " -s size Approximate size of the installation (default: $size)"
- echo " -h This message"
- exit 1
-}
-
-# Get options
-while getopts "c:r:a:d:s:h" opt ; do
- case $opt in
- c)
- config=$OPTARG
- ;;
- r)
- releasever=$OPTARG
- ;;
- a)
- basearch=$OPTARG
- ;;
- d)
- usr_share=$OPTARG
- ;;
- s)
- size=$OPTARG
- ;;
- h|*)
- usage
- ;;
- esac
-done
-
-root=fc$releasever
-data=data$releasever
-
-if [ ! -f $root.img ] ; then
- bs=4096
- count=$(($size / 4096))
- dd bs=$bs count=$count if=/dev/zero of=$root.img
- mkfs.ext3 -j -F $root.img
-fi
-
-mkdir -p $root $data
-mount -o loop $root.img $root
-trap "umount $root; exit 1" ERR