4 # Assumes pxe config for dhcp has been setup.
5 # Deploy fai configuration to faiserver,
6 # then start a virtual machine to test the config.
9 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
11 # I had this set false as default before, can't remember why. oh well.
13 if [[ $1 == -r ]]; then
19 script_dir
=$
(dirname $
(readlink
-f "$BASH_SOURCE"))
21 if [[ $script_dir == /a
/bin
/* ]]; then
24 cp -ar /a
/bin
/fai
/a
/tmp
/fai2
25 exec /a
/tmp
/fai
2/${BASH_SOURCE##*/} "$@"
31 [[ ${0##*/} == arch-revm
]]
35 [[ ! $1 ]] || new_disk
=true
40 # via osinfo-query os. guessing arch is closest to latest fedora.
57 for ((i
=1; i
<= disk_count
; i
++)); do
58 f
=/var
/lib
/libvirt
/images
/${name}$i
59 disk_arg
+=("--disk path=$f")
60 if $new_disk ||
[[ ! -e $f ]]; then
62 s qemu-img create
-o preallocation
=metadata
-f qcow2
$f 20G
66 if [[ $SSH_CLIENT ]]; then
67 console_arg
=--noautoconsole
70 # --cpu host: this causes mkfs.btrfs to fail with a stack trace which began
72 # init_module+0x108/0x1000 [raid6_pq]
74 # uniq is to stop gtk-warning spam
75 s virt-install
--os-variant $variant -n $name --pxe -r 2048 --vcpus 1 \
76 ${disk_arg[*]} -w bridge
=br0
,mac
=52:54:00:9c
:ef
:ad \
77 --graphics spice
,listen
=0.0.0.0 $console_arg |
& grep -v '^$' |
uniq &
79 if [[ $SSH_CLIENT ]]; then
85 while ! timeout
10 ssh $name /bin
/true
; do sleep 1; done
86 .
/arch-init-remote
$name