4 # Deploy fai configuration to faiserver,
5 # then start a virtual machine to test the config.
8 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
10 cd $
(dirname $
(readlink
-f "$BASH_SOURCE"))
13 # i use faiserver as a dns alias, but ssh key is associated with
14 # a canonical hostname and we will have ssh warning spam unless we
15 # use it, so look it up.
16 faiserver_host
=$
(chost faiserver
) || faiserver_host
=faiserver
19 ssh root@
$faiserver_host rm -rf /srv
/fai
/config
20 scp
-r fai
/config root@
$faiserver_host:/srv
/fai
21 # fai example pass: fai
22 #ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
24 # generating a hashed password:
25 # under debian, you can do
26 # echo "yoursecrectpassword" | mkpasswd -m sha-512 -s
27 # On arch, best seems to be copy your shadow file to a temp location,
28 # then passwd, get out the new pass, then copy the shadow file back.
30 f
=/q
/root
/shadow
/standard
32 ssh root@
$faiserver_host tee -a /srv
/fai
/config
/class
/DEFAULT.var
<<EOF
37 tpvar
="$(s cat /q/root/shadow/traci-simple)"
38 ssh root@
$faiserver_host tee -a /srv
/fai
/config
/class
/tp.var
<<EOF
42 scp ~
/.ssh
/id_rsa.pub \
43 root@
$faiserver_host:/srv
/fai
/config
/files
/home
/ian
/.ssh
/authorized_keys
/GRUB_PC
44 # todo: automatically disable faiserver after a period so
45 # these files are not exposed.
46 s scp
-r /q
/root
/luks
/q
/root
/shadow
/traci
{,-simple} \
47 root@
$faiserver_host:/srv
/fai
/config
/distro-install-common
48 scp
/a
/bin
/devbyid root@
$faiserver_host:/srv
/fai
/nfsroot
/usr
/local
/bin
49 ssh root@
$faiserver_host bash
<<'EOF'
51 chmod 644 /srv/fai/config/files/home/ian/.ssh/authorized_keys/GRUB_PC
52 chmod -R a+rX /srv/fai/config/distro-install-common