fix bugs, support multiple distros via subvolumes
[automated-distro-installer] / arch-init-remote
1 #!/bin/bash -lx
2
3
4 set -eE -o pipefail
5 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
6
7 host=$1
8
9 [[ $host == frodo ]] && scp /a/c/machine_specific/frodo/subdir_files/.ssh/* frodo:.ssh/
10 if [[ -e /var/cache/pacman/pkg ]]; then
11 darkhttpd /var/cache/pacman/pkg &
12 url=http://$HOSTNAME:8080
13 fi
14 faid=/a/bin/fai
15 fai_files=(
16 distro-install-common
17 hooks/partition.DEFAULT
18 class/50-host-classes
19 )
20 sudo scp -r /a/bin/fai/arch-init{,-chroot} \
21 ${fai_files[@]/#//a/bin/fai/fai/config/} \
22 /q/root/luks /p/shadow root@$host:
23 # creating shadow file string:
24 # on debian, you can use mkpasswd -m sha-512 to generate a pass.
25 # arch doesn't have this program. instead, you can do passwd,
26 # and extract it from the shadow file.
27 ssh root@$host bash -x ./arch-init "'$(cat /p/shadow/standard)'" $host $url
28 ssh root@$host reboot now || [[ $? == 255 ]]
29 # next up is:
30 # ssh $host /a/bin/distro-begin
31
32 killall darkhttpd
33 # todo: this doesn't work. figure out why.
34 #kill $!