3 # WARNING: looks like specifying another arch/preso won't work
8 #BUILD="${HOME}/git-build"
9 DOMAIN=pl.sophia.inria.fr
15 DISTRO=$DEFAULT_DISTRO
19 echo "usage : $COMMAND [-i] [-f distro] [-p perso] hostname"
20 echo " default distro is $DEFAULT_DISTRO"
21 echo " default perso is $DEFAULT_PERSO"
22 [ -n "$message" ] && echo $message
26 while getopts "f:p:ih" flag; do
30 i) INTERACTIVE=true ;;
35 [[ -z "$@" ]] && usage "no hostname provided"
37 [[ -n "$@" ]] && usage "extra arguments" "$@" "(hostname=$HOSTNAME)"
40 #[ -d "$BUILD" ] || usage "Could not find directory $BUILD"
42 [ -d /vservers/$HOSTNAME ] && usage "vserver $HOSTNAME already exists in /vservers"
43 # debian distros not found there - skip that
44 #[ -d /etc/vservers/.distributions/$DISTRO ] || usage "distro $DISTRO not known in /etc/vservers/.distributions/"
45 rpm -q debootstrap >& /dev/null || usage "You need to first run 'yum install debootstrap'"
47 fqdn=$HOSTNAME.$DOMAIN
49 host $fqdn | grep -q 'has address' || usage "hostname $fqdn not known to DNS"
50 ip=$(host $fqdn | grep 'has address' | awk '{print $4}')
56 # single_ip needs to be turned off, vtest-init-vserver now takes care of that
57 #command="$BUILD/vtest-init-vserver.sh -p $PERSO -f $DISTRO $HOSTNAME none -- --interface eth0:$ip --hostname $fqdn"
64 command="$PERSO vserver ${HOSTNAME} build -m debootstrap --interface eth0:${ip}/21 --hostname ${fqdn} -- -d ${DISTRO} -m http://ftp2.fr.debian.org/debian/ -- --verbose --arch=${arch} "
66 if [ -n "$INTERACTIVE" ] ; then
67 echo -n "Run $command OK ? "
68 read answer ; case $answer in [nN]*) exit 1 ;; esac
73 ### it looks like this is done too early or something
75 # with wheezy at least, we need to manually create these 2 directories when trying to vserver start for the first time..
76 ### post processing for starting up
77 for dir in run lock; do
78 echo "Checking for dir /var/$dir ..."
79 [ -d /vservers/${HOSTNAME}/var/$dir ] || mkdir /vservers/${HOSTNAME}/var/$dir
82 vserver ${HOSTNAME} start