#emacs: -*- mode: shell-script; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
#ex: set sts=4 ts=4 sw=4 noet:
+# fail early
set -eu
+
+function usage {
+echo "Usage: $0 [-p PRESEED -i ISO -m MIRROR -t TZ]
+
+Create ND VirtualBox appliance.
+
+Options:
+ -p PRESEED path to preesed file for d-i
+ -i ISO path to debian installation iso file
+ -m MIRROR debian mirror to use for installation
+ -t TZ time zone of virtual machine
+ -h Show this help and exit
+"
+}
+
+while getopts "p:" OPTION
+do
+ case $OPTION in
+ "f") $OPTARG;;
+ \?) exit 1;;
+ esac
+done
+
+
# TODO: arguments later on to become cmdline args
#iso=debian-squeeze-di-beta1-amd64-businesscard.iso
#iso=debian-6.0.3-${ARCH:=amd64}-businesscard.iso
-iso=debian-wheezy-DI-a1-${ARCH:=amd64}-businesscard.iso
-di_cd=$(readlink -f $PWD/../../../neurodebian-images/$iso)
-di_host=head1.hydra.dartmouth.edu # where to look for di preseed
+#iso=debian-wheezy-DI-a1-${ARCH:=amd64}-businesscard.iso
+
+di_cd=/backup/isos/debian-wheezy-DI-b1-amd64-netinst.iso
+# look here for more details about the default IP of the host:
+# # http://www.virtualbox.org/manual/ch09.html#changenat
+di_host=10.0.2.2 # where to look for di preseed
+di_port=10100
+di_preseed=/home/tiziano/git/neurodebian/vm/d-i/wheezy/preseed.cfg
+
build_dir=$PWD/build
dist_dir=$PWD/dist
vendor="NeuroDebian"
-vm_version="6.999.20120720"
+vm_version="6.999.20120827"
vm_ostype=Debian
vendor_url="http://neuro.debian.net"
product_url="${vendor_url}/vm.html"
rm -f ${vm_disk}
}
-clean_buildvm # clean things up
+clean_buildvm >&/dev/null # clean things up
#exit
# Check that no previous VM was left (can happen if previous failures
# type auto url=$di_host
# press Enter"
+# start local web server to serve preseed file
+cd $(dirname ${di_preseed}) && python -m SimpleHTTPServer ${di_port} >&/dev/null &
+
VBoxManage startvm "${vm_name}"
sleep 5 # give some time to make sure we get to menu
# 01 81 \
# 1e 9e 16 96 14 94 18 98 39 b9 16 96 13 93 26 a6 0d 8d 23 a3 15 95 20 a0 13 93 1e 9e \
# 1c 9c # ESCAPE, auto url=hydra, ENTER
-echo "typeGuest \"${vm_name}\" \"&ESC;Wauto url=${di_host}&ENTER;\"" | /usr/lib/virtualbox/vboxshell.py
-
-: "
-oops -- asked either I want to store Partitioning on the disk...
-
-didn't happen before
-"
+echo "typeGuest \"${vm_name}\" \"&ESC;Wauto url=${di_host}|;${di_port}/$(basename ${di_preseed})&ENTER;\"" | /usr/lib/virtualbox/vboxshell.py
# wait for it to finish! -- found no cleaner way :-/
sleep 10
sleep 5
done
+# kill the web server
+#kill ${webserver_pid}
+
_info Compacting VDI
sudo ./nd_compactvdi "${vm_disk}"