X-Git-Url: https://git.madduck.net/code/vinst.git/blobdiff_plain/599d602fabf5b0e92a7285c40f39413dd226ff52..6a3968790b2b2704e57aa4d0e272fb4abbc3d369:/vinst diff --git a/vinst b/vinst index 6ca0f76..dc0b82b 100755 --- a/vinst +++ b/vinst @@ -9,6 +9,9 @@ STORAGE_POOL=default QEMU_URI=qemu:///system SUITE=wheezy CONSOLE='console=tty0 console=ttyS0,115200n8' +DEBUG=0 +WIPE=0 +RESTART=0 while [ -n "$1" ]; do case "$1" in @@ -75,6 +78,16 @@ while [ -n "$1" ]; do fi ARCH="$1" ;; + (--debug) + DEBUG=1 + set -vx + ;; + (--wipe) + WIPE=1 + ;; + (--console) + RESTART=1 + ;; esac shift done @@ -124,7 +137,9 @@ cat >&2 <<_eof arch: $ARCH ram: $RAM MiB disk: $DISK GiB + wipe: $WIPE console: $CONSOLE + restart: $RESTART net bridge: $BRIDGE _eof if [ -n "$IPADDRESS" ]; then @@ -142,10 +157,18 @@ fi echo >&2 -set -v virsh --connect=$QEMU_URI vol-create-as $STORAGE_POOL virt-$HOSTNAME ${DISK}G +if [ $WIPE = 1 ]; then + virsh --connect=$QEMU_URI vol-wipe --pool $STORAGE_POOL --algorithm zero virt-$HOSTNAME +fi + +if [ $DEBUG = 1 ]; then + DEBUGFLAG=--debug + extra_args="$extra_args DEBCONF_DEBUG=5" +fi virt-install --connect=$QEMU_URI \ + ${DEBUGFLAG:-} \ -n $HOSTNAME \ -r $RAM \ --disk vol=$STORAGE_POOL/virt-$HOSTNAME \ @@ -157,9 +180,12 @@ virt-install --connect=$QEMU_URI \ -l $BASEDIR/installer-amd64 \ --initrd-inject=$BASEDIR/preseed/$SUITE/preseed.cfg \ --initrd-inject=$tmpdir/commands.tar \ - --prompt --noautoconsole --autostart \ + --noautoconsole --autostart \ --extra-args="$extra_args" \ "$@" virsh --connect=$QEMU_URI console $HOSTNAME -virsh --connect=$QEMU_URI "start $HOSTNAME; console $HOSTNAME" + +if [ $RESTART = 1]; then + virsh --connect=$QEMU_URI "start $HOSTNAME; console $HOSTNAME" +fi