main fai scripts can run outside of fai, fixup stuff
[automated-distro-installer] / arch-init-remote
1 #!/bin/bash -l
2
3 set -x
4
5 set -eE -o pipefail
6 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
7
8 if [[ ! $1 ]]; then
9 echo "error: expect a hostname in \$1 "
10 exit 1
11 fi
12 host=$1
13
14
15 scp -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null \
16 /p/c/machine_specific/$host/filesystem/etc/ssh/* root@$host:/etc/ssh
17
18 if [[ -e /var/cache/pacman/pkg ]]; then
19 darkhttpd /var/cache/pacman/pkg &
20 mirror=http://$HOSTNAME:8080
21 fi
22 faid=/a/bin/fai
23
24 rsync -rlpthvi --relative /a/bin/fai/ root@$host:/
25 rsync /a/bin/fai/ root@$host:/a/bin/fai/
26 sudo scp -r /a/bin/devbyid /q/root/luks /q/root/shadow root@$host:
27 # creating shadow file string:
28 # on debian, you can use mkpasswd -m sha-512 to generate a pass.
29 # arch doesn't have this program. instead, you can do passwd,
30 # and extract it from the shadow file.
31 ssh root@$host bash -x /a/bin/fai/arch-init $host $mirror
32
33 #ssh root@$host reboot now || [[ $? == 255 ]]
34
35 # next up is:
36 # ssh $host /a/bin/distro-begin
37
38 if [[ -e /var/cache/pacman/pkg ]]; then
39 killall darkhttpd
40 fi
41 # todo: this doesn't work. figure out why.
42 #kill $!