All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
   9 QEMU_URI=qemu:///system
 
  11 CONSOLE='console=tty0 console=ttyS0,115200n8'
 
  20         echo >&2 'E: --name/-n needs hostname argument'
 
  28         echo >&2 'E: --ipaddress/-i needs IP address/netmask'
 
  34           echo >&2 'E: missing netmask'
 
  43         echo >&2 'E: --dns/-d needs IP address'
 
  51         echo >&2 'E: --gateway/-g needs IP address'
 
  59         echo >&2 'E: --ram/-r needs number (megabytes)'
 
  67         echo >&2 'E: --size/-s needs size argument'
 
  75         echo >&2 'E: --arch/-a needs size argument'
 
  91 if [ -z "${HOSTNAME:-}" ]; then
 
  92   echo >&2 'E: hostname is required'
 
  96 BASEDIR=$(cd ${0%/*}; pwd)
 
  99 tar -C $BASEDIR/preseed/$SUITE -cf $tmpdir/commands.tar commands
 
 101 extra_args="auto $CONSOLE \
 
 102 hostname=${HOSTNAME%%.*} \
 
 103 domain=${HOSTNAME#*.}"
 
 105 if [ -n "$IPADDRESS" ]; then
 
 106   if [ -z "$GATEWAY" ] && [ -x $(command -v ipcalc) ]; then
 
 107     # default to the first IP in the network
 
 108     GATEWAY=$(ipcalc $IPADDRESS | grep HostMin | awk '{print $2}')
 
 110   NETMASK="${IPADDRESS#*/}"
 
 111   IPADDRESS="${IPADDRESS%/*}"
 
 112   : ${NAMESERVER:=$GATEWAY}
 
 114   extra_args="$extra_args netcfg/disable_dhcp=true \
 
 115   netcfg/get_ipaddress=$IPADDRESS \
 
 116   netcfg/get_netmask=$NETMASK \
 
 117   netcfg/get_gateway=$GATEWAY \
 
 118   netcfg/get_nameservers=$NAMESERVER"
 
 123   extra_args="$extra_args netcfg/disable_dhcp=false"
 
 127 if [ -z "$ARCH" ]; then
 
 128   ARCH=$(dpkg --print-architecture)
 
 140 if [ -n "$IPADDRESS" ]; then
 
 142  ipaddress: $IPADDRESS
 
 145 nameserver: $NAMESERVER
 
 155 virsh --connect=$QEMU_URI vol-create-as $STORAGE_POOL virt-$HOSTNAME ${DISK}G
 
 156 if [ $WIPE = 1 ]; then
 
 157   virsh --connect=$QEMU_URI vol-wipe --pool $STORAGE_POOL --algorithm zero virt-$HOSTNAME
 
 160 if [ $DEBUG = 1 ]; then
 
 162   extra_args="$extra_args DEBCONF_DEBUG=5"
 
 165 virt-install --connect=$QEMU_URI \
 
 169   --disk vol=$STORAGE_POOL/virt-$HOSTNAME \
 
 173   --watchdog i6300esb,action=reset \
 
 174   --os-variant=debian$SUITE \
 
 175   -l $BASEDIR/installer-amd64 \
 
 176   --initrd-inject=$BASEDIR/preseed/$SUITE/preseed.cfg \
 
 177   --initrd-inject=$tmpdir/commands.tar \
 
 178   --noautoconsole --autostart \
 
 179   --extra-args="$extra_args" \
 
 182 virsh --connect=$QEMU_URI console $HOSTNAME
 
 183 virsh --connect=$QEMU_URI "start $HOSTNAME; console $HOSTNAME"