trashed create-vm-debian.sh
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 5 Feb 2014 09:52:34 +0000 (10:52 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 5 Feb 2014 09:52:34 +0000 (10:52 +0100)
scripts/create-vm-debian.sh [deleted file]

diff --git a/scripts/create-vm-debian.sh b/scripts/create-vm-debian.sh
deleted file mode 100755 (executable)
index 33eebc2..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/bin/bash
-
-# WARNING: looks like specifying another arch/preso won't work
-
-COMMAND=$(basename $0)
-DIRNAME=$(dirname $0)
-
-#BUILD="${HOME}/git-build"
-DOMAIN=pl.sophia.inria.fr
-
-DEFAULT_DISTRO=wheezy
-DEFAULT_PERSO=linux64
-
-INTERACTIVE=
-DISTRO=$DEFAULT_DISTRO
-PERSO=$DEFAULT_PERSO
-function usage () {
-  message="$@" 
-  echo "usage : $COMMAND [-i] [-f distro] [-p perso] hostname"
-  echo "  default distro is $DEFAULT_DISTRO"
-  echo "  default perso is $DEFAULT_PERSO"
-  [ -n "$message" ] && echo $message
-  exit 1
-}
-
-while getopts "f:p:ih" flag; do
-    case $flag in
-       f) DISTRO=$OPTARG;;
-       p) PERSO=$OPTARG;;
-       i) INTERACTIVE=true ;;
-       ?|h) usage "" ;;
-    esac
-done
-shift $((OPTIND-1))
-[[ -z "$@" ]] && usage "no hostname provided"
-HOSTNAME="$1" ; shift
-[[ -n "$@" ]] && usage "extra arguments"  "$@" "(hostname=$HOSTNAME)"
-
-
-#[ -d "$BUILD" ] || usage "Could not find directory $BUILD"
-
-[ -d /vservers/$HOSTNAME ] && usage "vserver $HOSTNAME already exists in /vservers"
-# debian distros not found there - skip that
-#[ -d /etc/vservers/.distributions/$DISTRO ] || usage "distro $DISTRO not known in /etc/vservers/.distributions/"
-rpm -q debootstrap >& /dev/null || usage "You need to first run 'yum install debootstrap'"
-
-fqdn=$HOSTNAME.$DOMAIN
-## compute IP
-host $fqdn | grep -q 'has address' || usage "hostname $fqdn not known to DNS"
-ip=$(host $fqdn | grep 'has address' | awk '{print $4}')
-
-#cd $BUILD
-#git pull
-#cd -
-
-# single_ip needs to be turned off, vtest-initvm now takes care of that
-#command="$BUILD/vtest-initvm.sh -p $PERSO -f $DISTRO $HOSTNAME none -- --interface eth0:$ip --hostname $fqdn"
-
-case $PERSO in
-    linux32) arch=i386;;
-    linux64) arch=amd64;;
-esac
-
-case $DISTRO in
-    squeeze|wheezy) DEBMIRROR=http://ftp2.fr.debian.org/debian/ ;;
-# from the vserver man page DEBMIRROR=http://us.archive.ubuntu.com/ubuntu/ ;;
-    oneiric|precise|quantal) DEBMIRROR=http://mir1.ovh.net/ubuntu/ubuntu/ ;;
-    *) echo unknown distro $DISTRO; exit 1;;
-esac
-
-command="$PERSO vserver ${HOSTNAME} build -m debootstrap --interface eth0:${ip}/21 --hostname ${fqdn} -- -d ${DISTRO} -m ${DEBMIRROR} -- --verbose --arch=${arch} "
-
-if [ -n "$INTERACTIVE" ] ; then
-    echo -n "Run $command OK ? "
-    read answer ; case $answer in [nN]*) exit 1 ;; esac
-fi
-
-$command
-
-## stolen from vbuild-util-vserver (might be that we can actually use that one as-is...)
-# turns out that with wheezy at least, at this point we're getting 
-# /vservers/<vs>/var/run -> /run
-# /vservers/<vs>/var/lock -> /run/lock
-# trying to fix this with relative links does not appear to work fine
-# when trying to vserver start we're then getting
-# + exec /usr/sbin/vspace --mount --fs --new -- /usr/sbin/vserver ----nonamespace debuild09 start
-# fakerunlevel: open("/var/run/utmp"): No such file or directory
-# so instead we bluntly create empty dirs and hope for the best
-[ -h /vservers/${HOSTNAME}/var/run ] && [ ! -d /vservers/${HOSTNAME}/var/run ] && \
-    { rm -f /vservers/${HOSTNAME}/var/run ; mkdir /vservers/${HOSTNAME}/var/run ; }
-[ -h /vservers/${HOSTNAME}/var/lock ] && [ ! -d /vservers/${HOSTNAME}/var/lock ] && \
-    { rm -f /vservers/${HOSTNAME}/var/lock ; mkdir /vservers/${HOSTNAME}/var/lock ; }
-
-vserver ${HOSTNAME} start