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'
 
  19         echo >&2 'E: --name/-n needs hostname argument'
 
  27         echo >&2 'E: --ipaddress/-i needs IP address/netmask'
 
  33           echo >&2 'E: missing netmask'
 
  42         echo >&2 'E: --dns/-d needs IP address'
 
  50         echo >&2 'E: --gateway/-g needs IP address'
 
  58         echo >&2 'E: --ram/-r needs number (megabytes)'
 
  66         echo >&2 'E: --size/-s needs size argument'
 
  74         echo >&2 'E: --arch/-a needs size argument'
 
  87 if [ -z "${HOSTNAME:-}" ]; then
 
  88   echo >&2 'E: hostname is required'
 
  92 BASEDIR=$(cd ${0%/*}; pwd)
 
  95 tar -C $BASEDIR/preseed/$SUITE -cf $tmpdir/commands.tar commands
 
  97 extra_args="auto $CONSOLE \
 
  98 hostname=${HOSTNAME%%.*} \
 
  99 domain=${HOSTNAME#*.}"
 
 101 if [ -n "$IPADDRESS" ]; then
 
 102   if [ -z "$GATEWAY" ] && [ -x $(command -v ipcalc) ]; then
 
 103     # default to the first IP in the network
 
 104     GATEWAY=$(ipcalc $IPADDRESS | grep HostMin | awk '{print $2}')
 
 106   NETMASK="${IPADDRESS#*/}"
 
 107   IPADDRESS="${IPADDRESS%/*}"
 
 108   : ${NAMESERVER:=$GATEWAY}
 
 110   extra_args="$extra_args netcfg/disable_dhcp=true \
 
 111   netcfg/get_ipaddress=$IPADDRESS \
 
 112   netcfg/get_netmask=$NETMASK \
 
 113   netcfg/get_gateway=$GATEWAY \
 
 114   netcfg/get_nameservers=$NAMESERVER"
 
 119   extra_args="$extra_args netcfg/disable_dhcp=false"
 
 123 if [ -z "$ARCH" ]; then
 
 124   ARCH=$(dpkg --print-architecture)
 
 135 if [ -n "$IPADDRESS" ]; then
 
 137  ipaddress: $IPADDRESS
 
 140 nameserver: $NAMESERVER
 
 150 virsh --connect=$QEMU_URI vol-create-as $STORAGE_POOL virt-$HOSTNAME ${DISK}G
 
 152 if [ $DEBUG = 1 ]; then
 
 154   extra_args="$extra_args DEBCONF_DEBUG=5"
 
 157 virt-install --connect=$QEMU_URI \
 
 161   --disk vol=$STORAGE_POOL/virt-$HOSTNAME \
 
 165   --watchdog i6300esb,action=reset \
 
 166   --os-variant=debian$SUITE \
 
 167   -l $BASEDIR/installer-amd64 \
 
 168   --initrd-inject=$BASEDIR/preseed/$SUITE/preseed.cfg \
 
 169   --initrd-inject=$tmpdir/commands.tar \
 
 170   --noautoconsole --autostart \
 
 171   --extra-args="$extra_args" \
 
 174 virsh --connect=$QEMU_URI console $HOSTNAME
 
 175 virsh --connect=$QEMU_URI "start $HOSTNAME; console $HOSTNAME"