X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=myfai-chboot-local;h=66c496d069afa8dfb4f0b07782364a914c25cb1f;hb=7386cdbee20dd73095264e2ad0ead433f97ac946;hp=8d4e1ce480bda868f8d3f8546cbe4cbb14963da8;hpb=e729557712e9355ffa9103e6083d1161d5fd6063;p=automated-distro-installer diff --git a/myfai-chboot-local b/myfai-chboot-local index 8d4e1ce..66c496d 100755 --- a/myfai-chboot-local +++ b/myfai-chboot-local @@ -3,6 +3,13 @@ set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR +case $1 in + -h|--help) + echo "see help from myfai-chboot" + exit 0 + ;; +esac + [[ $EUID == 0 ]] || exec sudo "${BASH_SOURCE}" "$@" e() { echo "$@"; "$@"; } @@ -19,7 +26,7 @@ kernel=$(fai-chboot -L '^default$' | awk '{print $3}') # man page doesn't explain this, but this deletes & thus disables # all chboot systems. type -t host &>/dev/null || apt-get -y install dnsutils -gateway_ip=$(route -n | sed -rn 's/^(0\.){3}0\s+(\S+).*/\2/p') +gateway_ip=$(route -n | sed -rn 's/^0\.0\.0\.0\s+(\S+).*/\1/p') my_ip=$(host faiserver $gateway_ip | sed -rn 's/^\S+ has address //p') k_args=$(fai-chboot -L '^default$' | \ sed -r "s/^(\S+\s+){3}(.*root=)(.*)/\2$my_ip:\3/")