various fixes
[automated-distro-installer] / myfai-chboot
1 #!/bin/bash
2
3 set -eE -o pipefail
4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
5
6 x=$(readlink -f "$BASH_SOURCE"); cd ${x%/*}
7
8 usage() {
9 cat <<EOF
10 usage: ${0##*/} [-h|--help] [HOSTNAME|IP|default]
11
12 Sets up tftp pxe config and nfs server on host "faiserver".
13
14 If our kernel has no nfs support, uses apache intead of nfs, and depends
15 on another repo of Ian Kelling, basic-https-conf, where the file is at
16 /a/exe/web-conf.
17
18 Usng this, you can boot into fai with pxe-kexec without changing
19 the dhcp server.
20
21 Argument sets the host to enable it for. No argument disables pxe
22 config for all hosts, but leaves nfs server alone. Use faiserver-disable
23 to disable the nfs server.
24
25 -S sets FAI_ACTION=sysinfo, and remove fai flag reboot.
26 Usefull for doing a system recovery.
27 -h|--help Print help and exit.
28
29 EOF
30 exit $1
31 }
32 case $1 in
33 -h|--help) usage ;;
34 esac
35
36 kgped16=false # default
37 temp=$(getopt -l help hk "$@") || usage 1
38 eval set -- "$temp"
39 while true; do
40 case $1 in
41 -k) kgped16=true; shift ;;
42 -h|--help) usage ;;
43 --) shift; break ;;
44 *) echo "$0: Internal error! unexpected args: $*" ; exit 1 ;;
45 esac
46 done
47
48
49 host=$(./chost faiserver)
50 ssh root@$host bash -s -- "$@" <myfai-chboot-local