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'
18 echo >&2 'E: --name/-n needs hostname argument'
26 echo >&2 'E: --ipaddress/-i needs IP address/netmask'
32 echo >&2 'E: missing netmask'
41 echo >&2 'E: --dns/-d needs IP address'
49 echo >&2 'E: --gateway/-g needs IP address'
57 echo >&2 'E: --ram/-r needs number (megabytes)'
65 echo >&2 'E: --size/-s needs size argument'
73 echo >&2 'E: --arch/-a needs size argument'
82 if [ -z "${HOSTNAME:-}" ]; then
83 echo >&2 'E: hostname is required'
87 BASEDIR=$(cd ${0%/*}; pwd)
90 tar -C $BASEDIR/preseed/$SUITE -cf $tmpdir/commands.tar commands
92 extra_args="auto $CONSOLE \
93 hostname=${HOSTNAME%%.*} \
94 domain=${HOSTNAME#*.}"
96 if [ -n "$IPADDRESS" ]; then
97 if [ -z "$GATEWAY" ] && [ -x $(command -v ipcalc) ]; then
98 # default to the first IP in the network
99 GATEWAY=$(ipcalc $IPADDRESS | grep HostMin | awk '{print $2}')
101 NETMASK="${IPADDRESS#*/}"
102 IPADDRESS="${IPADDRESS%/*}"
103 : ${NAMESERVER:=$GATEWAY}
105 extra_args="$extra_args netcfg/disable_dhcp=true \
106 netcfg/get_ipaddress=$IPADDRESS \
107 netcfg/get_netmask=$NETMASK \
108 netcfg/get_gateway=$GATEWAY \
109 netcfg/get_nameservers=$NAMESERVER"
114 extra_args="$extra_args netcfg/disable_dhcp=false"
118 if [ -z "$ARCH" ]; then
119 ARCH=$(dpkg --print-architecture)
130 if [ -n "$IPADDRESS" ]; then
132 ipaddress: $IPADDRESS
135 nameserver: $NAMESERVER
146 virsh --connect=$QEMU_URI vol-create-as $STORAGE_POOL virt-$HOSTNAME ${DISK}G
148 virt-install --connect=$QEMU_URI \
151 --disk vol=$STORAGE_POOL/virt-$HOSTNAME \
155 --watchdog i6300esb,action=reset \
156 --os-variant=debian$SUITE \
157 -l $BASEDIR/installer-amd64 \
158 --initrd-inject=$BASEDIR/preseed/$SUITE/preseed.cfg \
159 --initrd-inject=$tmpdir/commands.tar \
160 --prompt --noautoconsole --autostart \
161 --extra-args="$extra_args" \
164 virsh --connect=$QEMU_URI console $HOSTNAME
165 virsh --connect=$QEMU_URI "start $HOSTNAME; console $HOSTNAME"