usage() {
cat <<EOF
-usage: ${0##*/} [-h|--help] [HOSTNAME|IP|default]
+usage: ${0##*/} [OPTIONS] [HOSTNAME|IP|default]
Sets up tftp pxe config and nfs server on host "faiserver".
to disable the nfs server.
-S sets FAI_ACTION=sysinfo, and remove fai flag reboot.
- Usefull for doing a system recovery.
+ Usefull for doing a system recovery. It reboots automatically anyways :(
+-k Add serial port output for kgped16
+-i sets FAI_ACTION=inventory and remove fai flag reboot.
+ I'm not sure what this is usefull for.
-h|--help Print help and exit.
EOF
-h|--help) usage ;;
esac
-kgped16=false # default
-temp=$(getopt -l help hk "$@") || usage 1
-eval set -- "$temp"
-while true; do
- case $1 in
- -k) kgped16=true; shift ;;
- -h|--help) usage ;;
- --) shift; break ;;
- *) echo "$0: Internal error! unexpected args: $*" ; exit 1 ;;
- esac
-done
-
+faiserver_addr=$(host faiserver | sed -rn 's/^\S+ has address //p;T;q' ||:)
host=$(./chost faiserver)
-ssh root@$host bash -s -- "$@" <myfai-chboot-local
+if ip a | grep "^ *inet.\? $faiserver_addr" &>/dev/null; then
+ ./myfai-chboot-local "$@"
+else
+ ssh root@$host bash -s -- "$@" <myfai-chboot-local
+fi