]> git.donarmstrong.com Git - neurodebian.git/commitdiff
WIP: do not use external HTTP server
authorTiziano Zito <opossumnano@gmail.com>
Thu, 30 Aug 2012 13:53:05 +0000 (15:53 +0200)
committerTiziano Zito <opossumnano@gmail.com>
Thu, 30 Aug 2012 13:53:05 +0000 (15:53 +0200)
vm/tools/nd_createappliance

index d4fb316c4ab55c82d57e0008ccd50733f0bc8dcf..ef2e32989eb93d53c16cc0d025f1da988fd3517a 100755 (executable)
@@ -2,19 +2,50 @@
 #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"
@@ -63,7 +94,7 @@ VBoxManage unregistervm "${vm_name}" --delete || :
 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
@@ -133,6 +164,9 @@ _info "Run Debian Installer"
 # 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
@@ -141,13 +175,7 @@ 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
@@ -155,6 +183,9 @@ while VBoxManage showvminfo "${vm_name}" | grep -q running; do
     sleep 5
 done
 
+# kill the web server
+#kill ${webserver_pid}
+
 _info Compacting VDI
 sudo ./nd_compactvdi "${vm_disk}"