use disk/by-id if possibe, other small fixes
[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 /a/bin/devbyid \
23 /q/root/luks /q/root/shadow root@$host:
24 # creating shadow file string:
25 # on debian, you can use mkpasswd -m sha-512 to generate a pass.
26 # arch doesn't have this program. instead, you can do passwd,
27 # and extract it from the shadow file.
28 ssh root@$host bash -x ./arch-init "'$(cat /p/shadow/standard)'" $host $url
29 ssh root@$host reboot now || [[ $? == 255 ]]
30 # next up is:
31 # ssh $host /a/bin/distro-begin
32
33 killall darkhttpd
34 # todo: this doesn't work. figure out why.
35 #kill $!