add copyright, fix arch
[automated-distro-installer] / dsfull
1 #!/bin/bash -l
2 # Copyright (C) 2016 Ian Kelling
3
4 # distro setup full. (assuming we already synced data files to the host)
5
6 set -eE -o pipefail
7 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
8
9 reboot=true
10 if [[ $1 == -r ]]; then
11 reboot=false
12 shift
13 fi
14
15 host=$1
16
17 if [[ ! $host || $host == -h ]]; then
18 echo "$0: error: expected 1 arg of hostname"
19 exit 1
20 fi
21
22 set -x
23 if $reboot; then
24 # untested, this caused hang using here doc.
25 ssh $host sudo bash -c "touch /tmp/keyscript-off; reboot" ||:
26 fi
27
28 pxe-server fai $host
29 while ! ssh $host :; do
30 sleep 5
31 done
32 dsremote $host