add wrt and fai server setup scripts
[automated-distro-installer] / fai-redep
1 #!/bin/bash -l
2 set -x
3
4 # Deploy fai configuration to faiserver,
5 # then start a virtual machine to test the config.
6
7 set -eE -o pipefail
8 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
9
10 cd $(dirname $(readlink -f "$BASH_SOURCE"))
11
12 ssh root@faiserver rm -rf /srv/fai/config
13 scp -r fai/config root@faiserver:/srv/fai
14 # fai example pass: fai
15 #ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
16
17 # generating a hashed password:
18 # under debian, you can do
19 # echo "yoursecrectpassword" | mkpasswd -m sha-512 -s
20 # On arch, best seems to be copy your shadow file to a temp location,
21 # then passwd, get out the new pass, then copy the shadow file back.
22 ssh root@faiserver tee -a /srv/fai/config/class/DEFAULT.var <<EOF
23 ROOTPW='$(cat /p/shadow/standard)'
24 EOF
25 ssh root@faiserver tee -a /srv/fai/config/class/tp.var <<EOF
26 ROOTPW='$(cat /p/shadow/traci-simple)'
27 EOF
28
29 scp ~/.ssh/id_rsa.pub \
30 root@faiserver:/srv/fai/config/files/home/ian/.ssh/authorized_keys/GRUB_PC
31 s scp -r /q/root/luks /p/shadow/traci{,-simple} \
32 root@faiserver:/srv/fai/config/distro-install-common
33 ssh root@faiserver chmod -R a+rX /srv/fai/config/distro-install-common