various fixes
[automated-distro-installer] / myfai-chboot
index de798e4d1afc0db0a8d0bd6c6421c423e00ed682..db19cb63077d4555d6527546f670a614f515ac4a 100755 (executable)
@@ -7,7 +7,7 @@ x=$(readlink -f "$BASH_SOURCE"); cd ${x%/*}
 
 usage() {
   cat <<EOF
-usage: ${0##*/} [-h|--help] HOSTNAME|IP|default
+usage: ${0##*/} [-h|--help] [HOSTNAME|IP|default]
 
 Sets up tftp pxe config and nfs server on host "faiserver".
 
@@ -29,13 +29,22 @@ to disable the nfs server.
 EOF
   exit $1
 }
-if [[ ! $1 ]]; then
-  usage 1
-fi
 case $1 in
   -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
 
-host=$(chost faiserver)
+
+host=$(./chost faiserver)
 ssh root@$host bash -s -- "$@" <myfai-chboot-local