2 # This file is part of Ian Kelling's automated-distro-installer
3 # Copyright (C) 2024 Ian Kelling
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 set -e; .
/usr
/local
/lib
/bash-bear
; set +e
23 usage: this-script [-h|--help]
24 Create a vm which is a fai server.
26 This assumes you've set the dhcp server to make 52:54:00:56:09:f9 be
27 faiserver. That mac is a randomly generated one in the libvirt range.
29 WARNING: has hardcoded IP and name for for my local lan
38 err-cleanup
() { pxe-server
:; }
39 .
/debian-pxe-preseed
-i 10.0.0.1 -u iank
-g vda
44 f
=/var
/lib
/libvirt
/images
/${name}
45 s qemu-img create
-o preallocation
=metadata
-f qcow2
$f 30G
47 # uniq because virt-viewer spams me with pointless gtk warnings
48 s virt-install
--os-variant debian8
--cpu host -n $name --pxe -r 1024 --vcpus 1 \
49 --disk $f -w bridge
=br0
,mac
=52:54:00:56:09:f9 |
& sed "/^ *$/d" |
uniq &
51 sleep $
((60*6)) # takes like 10x as long as a fai install!
53 opts
="-oStrictHostKeyChecking=false -oUserKnownHostsFile=/dev/null"
54 while ! scp
$opts faiserver-setup root@faiserver.b8.nz
:; do
58 # note: with a vm, pxe boot is turned off in the bios after it's first reboot.
62 ssh $opts root@faiserver.b8.nz .
/faiserver-setup