# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2004-2006 The Trustees of Princeton University
#
-# $Id: build.sh,v 1.8 2006/03/31 21:18:10 mlhuang Exp $
+# $Id: build.sh,v 1.18.2.1 2007/08/30 16:39:09 mef Exp $
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
-# Release and architecture to install
-releasever=2
-basearch=i386
+# build.common comes from the build module
+. build.common
+pl_process_fedora_options $@
+shiftcount=$?
+shift $shiftcount
+
+# XXX this should be coming from some configuration file
# Packages to install
packagelist=(
bash
time
vixie-cron
wget
+which
yum
curl
gzip
perl
python
tar
+findutils
)
-usage()
-{
- echo "Usage: build.sh [OPTION]..."
- echo " -r release Fedora release number (default: $releasever)"
- echo " -a arch Fedora architecture (default: $basearch)"
- echo " -h This message"
- exit 1
-}
-
-# Get options
-while getopts "r:a:h" opt ; do
- case $opt in
- r)
- releasever=$OPTARG
- ;;
- a)
- basearch=$OPTARG
- ;;
- h|*)
- usage
- ;;
- esac
+# vserver-reference packages used for reference image
+for package in "${packagelist[@]}" ; do
+ packages="$packages -p $package"
done
# Do not tolerate errors
set -e
# Make /vservers
-vroot=$PWD/vservers/vserver-reference
+vroot=$PWD/vservers/.vref/default
install -d -m 755 $vroot
-# Install vserver-reference system
-for package in "${packagelist[@]}" ; do
- packages="$packages -p $package"
-done
-mkfedora -v -r $releasever -a $basearch $packages $vroot
-
-# Disable all services in reference image
-chroot $vroot sh -c "/sbin/chkconfig --list | awk '{ print \$1 }' | xargs -i /sbin/chkconfig {} off"
+# Populate a minimal /dev in the reference image
+pl_makedevs $vroot
-# This tells the Boot Manager that it is okay to update
-# /etc/resolv.conf and /etc/hosts whenever the network configuration
-# changes. Users are free to delete this file.
-touch $vroot/etc/AUTO_UPDATE_NET_FILES
+# Populate image with vserver-reference packages
+pl_setup_chroot $vroot $packages
exit 0