4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
6 [[ $EUID == 0 ]] ||
exec sudo
"${BASH_SOURCE}" "$@"
8 e
() { echo "$@"; "$@"; }
11 rm -f /srv
/tftp
/fai
/pxelinux.cfg
/*
16 std_arg
="-u nfs://faiserver/srv/fai/config"
17 e fai-chboot
-Iv $std_arg default
# set it to default to get a val out of it next
18 kernel
=$
(fai-chboot
-L '^default$' |
awk '{print $3}')
19 # man page doesn't explain this, but this deletes & thus disables
21 type -t host &>/dev
/null || apt-get
-y install dnsutils
22 gateway_ip
=$
(route
-n |
sed -rn 's/^(0\.){3}0\s+(\S+).*/\2/p')
23 my_ip
=$
(host faiserver
$gateway_ip |
sed -rn 's/^\S+ has address //p')
24 k_args
=$
(fai-chboot
-L '^default$' | \
25 sed -r "s/^(\S+\s+){3}(.*root=)(.*)/\2$my_ip:\3/")
26 rm -f /srv
/tftp
/fai
/pxelinux.cfg
/*
27 e fai-chboot
-k "$k_args" -v -f verbose
,sshd
,createvt
,reboot
$std_arg $kernel "$@"
30 # todo, remove the nopxe script. adjust fai-check to reboot if it fails on the kexec.