use build/build.common functions
[sliceimage.git] / build.sh
index 58f8bcb..be62285 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -5,7 +5,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2004-2006 The Trustees of Princeton University
 #
-# $Id: build.sh,v 1.4 2006/03/21 14:57:29 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
@@ -17,48 +17,67 @@ if [ -d ../build ] ; then
     PATH=$PATH:../build
     srcdir=..
 else
-    echo "Error: Could not find sources in either . or .."
+    echo "Error: Could not find $(cd .. && pwd -P)/build/"
     exit 1
 fi
 
 export PATH
 
-# Release and architecture to install
-releasever=2
-basearch=i386
+# build.common comes from the build module
+. build.common
 
-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
-}
+pl_process_fedora_options $@
+shiftcount=$?
+shift $shiftcount
+
+# XXX this should be coming from some configuration file
+# Packages to install
+packagelist=(
+bash
+coreutils
+iputils
+kernel-vserver
+bzip2
+crontabs
+diffutils
+logrotate
+openssh-clients
+passwd
+rsh
+rsync
+sudo
+tcpdump
+telnet
+traceroute
+time
+vixie-cron
+wget
+which
+yum
+curl
+gzip
+perl
+python
+tar
+findutils
+)
 
-# 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
-mkfedora -v -r $releasever -a $basearch -g VServer $vroot
+# Populate a minimal /dev in the reference image
+pl_makedevs $vroot
+
+# Populate image with vserver-reference packages
+pl_setup_chroot $vroot $packages
 
-# 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
+exit 0