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'
74 if [ -z "${HOSTNAME:-}" ]; then
75 echo >&2 'E: hostname is required'
79 BASEDIR=$(cd ${0%/*}; pwd)
82 tar -C $BASEDIR/preseed/$SUITE -cf $tmpdir/commands.tar commands
84 extra_args="auto $CONSOLE \
85 hostname=${HOSTNAME%%.*} \
86 domain=${HOSTNAME#*.}"
88 if [ -n "$IPADDRESS" ]; then
89 if [ -z "$GATEWAY" ] && [ -x $(command -v ipcalc) ]; then
90 # default to the first IP in the network
91 GATEWAY=$(ipcalc $IPADDRESS | grep HostMin | awk '{print $2}')
93 NETMASK="${IPADDRESS#*/}"
94 IPADDRESS="${IPADDRESS%/*}"
95 : ${NAMESERVER:=$GATEWAY}
97 extra_args="$extra_args netcfg/disable_dhcp=true \
98 netcfg/get_ipaddress=$IPADDRESS \
99 netcfg/get_netmask=$NETMASK \
100 netcfg/get_gateway=$GATEWAY \
101 netcfg/get_nameservers=$NAMESERVER"
104 extra_args="$extra_args netcfg/disable_dhcp=false"
113 if [ -n "$IPADDRESS" ]; then
115 ipaddress: $IPADDRESS
118 nameserver: $NAMESERVER
128 exec virt-install --connect=$QEMU_URI \
131 --disk pool=default,size=$SIZE \
135 --watchdog i6300esb,action=reset \
136 --os-variant=debian$SUITE \
137 -l $BASEDIR/installer-amd64 \
138 --initrd-inject=$BASEDIR/preseed/$SUITE/preseed.cfg \
139 --initrd-inject=$tmpdir/commands.tar \
140 --extra-args="$extra_args" \