3 # Builds VServer reference image
5 # Mark Huang <mlhuang@cs.princeton.edu>
6 # Copyright (C) 2004-2006 The Trustees of Princeton University
8 # $Id: build.sh,v 1.16 2007/06/25 19:52:27 deisenst Exp $
11 PATH=/sbin:/bin:/usr/sbin:/usr/bin
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
20 echo "Error: Could not find $(cd .. && pwd -P)/build/"
26 # Release and architecture to install
62 echo "Usage: build.sh [OPTION]..."
63 echo " -r release Fedora release number (default: $releasever)"
64 echo " -a arch Fedora architecture (default: $basearch)"
65 echo " -h This message"
70 while getopts "r:a:h" opt ; do
84 # Do not tolerate errors
88 vroot=$PWD/vservers/.vref/default
89 install -d -m 755 $vroot
91 # Install default reference image
92 for package in "${packagelist[@]}" ; do
93 packages="$packages -p $package"
95 mkfedora -v -r $releasever -a $basearch -k $packages $vroot
100 mknod -m 666 $vroot/dev/null c 1 3
101 mknod -m 666 $vroot/dev/zero c 1 5
102 mknod -m 666 $vroot/dev/full c 1 7
103 mknod -m 644 $vroot/dev/random c 1 8
104 mknod -m 644 $vroot/dev/urandom c 1 9
105 mknod -m 666 $vroot/dev/tty c 5 0
106 mknod -m 666 $vroot/dev/ptmx c 5 2
107 # For bash command substitution
108 ln -nsf ../proc/self/fd $vroot/dev/fd
109 # For df and linuxconf
110 touch $vroot/dev/hdv1
112 mkdir -p $vroot/dev/net
113 mknod -m 600 $vroot/dev/net/tun c 10 200
115 mkdir -p $vroot/dev/pts
117 # Disable all services in reference image
118 chroot $vroot sh -c "/sbin/chkconfig --list | awk '{ print \$1 }' | xargs -i /sbin/chkconfig {} off"
120 # This tells the Boot Manager that it is okay to update
121 # /etc/resolv.conf and /etc/hosts whenever the network configuration
122 # changes. Users are free to delete this file.
123 touch $vroot/etc/AUTO_UPDATE_NET_FILES