X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=pxe-server;h=3623cc848230b1d25ae87618db4d7403797659bc;hb=21353fd35096ba6786c1bae3046b763bfeac5890;hp=c46c72eb34c1141433f9e8c3c177ab448f034d14;hpb=917fa30617ccafa3a7ed5218a418cf058948b729;p=automated-distro-installer diff --git a/pxe-server b/pxe-server index c46c72e..3623cc8 100755 --- a/pxe-server +++ b/pxe-server @@ -61,6 +61,11 @@ EOF exit $1 } +pre="${0##*/}:" +m() { printf "$pre %s\n" "$*"; "$@"; } +e() { printf "$pre %s\n" "$*"; } +err() { echo "[$(date +'%Y-%m-%d %H:%M:%S%z')]: $pre: $*" >&2; } + ##### begin command line parsing ######## dhcp=true @@ -125,16 +130,11 @@ fi ##### end command line parsing ######## -e() { - echo "$@" - "$@" -} - archlike() { cat </dev/null || sudo apt-get -y install dnsutils +faiserverip=$(host faiserver | sed -rn 's/^\S+ has address //p;T;q' ||:) +if [[ ! $faiserverip || $faiserverip =~ [[:space:]] ]]; then + echo "$0: error: failed to get \$faiserverip, got: $faiserverip" + exit 1 +fi + if $set; then set-pxe if [[ $type == fai ]]; then - e myfai-chboot ${chboot_args[@]} $host + m myfai-chboot ${chboot_args[@]} $host if $redep; then - e fai-redep + m fai-redep fi else # This will fail if faiserver is not setup, so ignore any