X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=build.sh;h=f1433f5c95b48f33498697cbf21ff87c69961080;hb=91029451fc61906dcc37343fcfbdcded25da3435;hp=58f8bcbaa25c22e94870cf2e7036a504c601e753;hpb=3c4acaae7d85ef51ffe2d0a861bc456cf212c3ab;p=vserver-reference.git diff --git a/build.sh b/build.sh index 58f8bcb..f1433f5 100755 --- a/build.sh +++ b/build.sh @@ -5,7 +5,7 @@ # Mark Huang # 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.17 2007/08/13 18:02:33 faiyaza Exp $ # PATH=/sbin:/bin:/usr/sbin:/usr/bin @@ -17,16 +17,47 @@ 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 +releasever=4 basearch=i386 +# 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 +) + usage() { echo "Usage: build.sh [OPTION]..." @@ -51,14 +82,45 @@ while getopts "r:a:h" opt ; do esac 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 +# Install default reference image +for package in "${packagelist[@]}" ; do + packages="$packages -p $package" +done +mkfedora -v -r $releasever -a $basearch -k $packages $vroot + +# Clean /dev +rm -rf $vroot/dev +mkdir -p $vroot/dev +mknod -m 666 $vroot/dev/null c 1 3 +mknod -m 666 $vroot/dev/zero c 1 5 +mknod -m 666 $vroot/dev/full c 1 7 +mknod -m 644 $vroot/dev/random c 1 8 +mknod -m 644 $vroot/dev/urandom c 1 9 +mknod -m 666 $vroot/dev/tty c 5 0 +mknod -m 666 $vroot/dev/ptmx c 5 2 +# For bash command substitution +ln -nsf ../proc/self/fd $vroot/dev/fd +# For df and linuxconf +touch $vroot/dev/hdv1 +# For TUN/TAP +mkdir -p $vroot/dev/net +mknod -m 600 $vroot/dev/net/tun c 10 200 +# For pseudo ttys +mkdir -p $vroot/dev/pts + +# Disable all services in reference image +chroot $vroot sh -c "/sbin/chkconfig --list | awk '{ print \$1 }' | xargs -i /sbin/chkconfig {} off" # 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