main fai scripts can run outside of fai, fixup stuff
[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 $?" >&2' ERR
9
10 cd $(dirname $(readlink -f "$BASH_SOURCE"))
11
12
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 just to avoid the warning spam.
16 faiserver_host=$(chost faiserver) || faiserver_host=faiserver
17
18
19 ssh root@$faiserver_host rm -rf /srv/fai/config
20 scp -r fai/config root@$faiserver_host:/srv/fai
21
22
23 scp ~/.ssh/id_rsa.pub \
24 root@$faiserver_host:/srv/fai/config/files/home/ian/.ssh/authorized_keys/GRUB_PC
25 # todo: automatically disable faiserver after a period so
26 # these files are not exposed.
27 s scp -r /q/root/luks /q/root/shadow \
28 root@$faiserver_host:/srv/fai/config/distro-install-common
29 scp /a/bin/devbyid root@$faiserver_host:/srv/fai/nfsroot/usr/local/bin
30 ssh root@$faiserver_host bash <<'EOF'
31 set -eE -o pipefail
32 chmod 644 /srv/fai/config/files/home/ian/.ssh/authorized_keys/GRUB_PC
33 chmod -R a+rX /srv/fai/config/distro-install-common
34 EOF