- build vserver-reference using mkfedora script
[sliceimage.git] / build.sh
1 #!/bin/bash
2 #
3 # Builds VServer reference image
4 #
5 # Mark Huang <mlhuang@cs.princeton.edu>
6 # Copyright (C) 2004-2006 The Trustees of Princeton University
7 #
8 # $Id: build.sh,v 1.4 2006/03/21 14:57:29 mlhuang Exp $
9 #
10
11 PATH=/sbin:/bin:/usr/sbin:/usr/bin
12
13 # In both a normal CVS environment and a PlanetLab RPM
14 # build environment, all of our dependencies are checked out into
15 # directories at the same level as us.
16 if [ -d ../build ] ; then
17     PATH=$PATH:../build
18     srcdir=..
19 else
20     echo "Error: Could not find sources in either . or .."
21     exit 1
22 fi
23
24 export PATH
25
26 # Release and architecture to install
27 releasever=2
28 basearch=i386
29
30 usage()
31 {
32     echo "Usage: build.sh [OPTION]..."
33     echo "      -r release      Fedora release number (default: $releasever)"
34     echo "      -a arch         Fedora architecture (default: $basearch)"
35     echo "      -h              This message"
36     exit 1
37 }
38
39 # Get options
40 while getopts "r:a:h" opt ; do
41     case $opt in
42         r)
43             releasever=$OPTARG
44             ;;
45         a)
46             basearch=$OPTARG
47             ;;
48         h|*)
49             usage
50             ;;
51     esac
52 done
53
54 # Make /vservers
55 vroot=$PWD/vservers/vserver-reference
56 install -d -m 755 $vroot
57
58 # Install vserver-reference system
59 mkfedora -v -r $releasever -a $basearch -g VServer $vroot
60
61 # This tells the Boot Manager that it is okay to update
62 # /etc/resolv.conf and /etc/hosts whenever the network configuration
63 # changes. Users are free to delete this file.
64 touch $vroot/etc/AUTO_UPDATE_NET_FILES