X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai-kexec;h=ae59f7cb3d6d56da7d5f742385152860cee541be;hb=11a2db1a576e78f58af7f1e7e4c83422635b630d;hp=5e10ac2d1000df9eebadd0bdd2661afe5afcf74b;hpb=bcdb96792264d6cda20e6d2fa176728a67c87862;p=automated-distro-installer diff --git a/fai-kexec b/fai-kexec index 5e10ac2..ae59f7c 100755 --- a/fai-kexec +++ b/fai-kexec @@ -14,11 +14,28 @@ # limitations under the License. -# kexec to fai tftp server that pxe would normally point to - set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR +[[ $EUID == 0 ]] || exec sudo "$BASH_SOURCE" "$@" + +usage() { + cat <<'EOF' +usage: $0 [-h|--help] [SERVER] +Kexec this or a remote machine using host faiserver + +If SERVER argument, ssh to root@SERVER before doing kexec. This does +what pxe would do, but skipping boot sequence up to and including the +pxe dhcp. + +EOF + exit $1 +} +case $1 in + -h|--help) usage ;; +esac + + if [[ $1 ]]; then prefix="ssh root@$1" fi