X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=chost;h=204637b003852d21d7c661b966f41e9a69d73ae5;hb=14f283f82afc48d6cec1bb7498ec34ac2b0da77c;hp=a26529fee9efbeaf3a14632946d59d4e84d7bc8d;hpb=c47175685b348735b3440e16851dde2cc39b6f3f;p=automated-distro-installer diff --git a/chost b/chost index a26529f..204637b 100755 --- a/chost +++ b/chost @@ -11,5 +11,13 @@ host=$1 # a valid address and we just use that addr=$(host $host | sed -rn 's/^\S+ has address //p;T;q' ||:) h=$(host $addr) +case $h in + *"no PTR record") + echo "error: chost: $h" >&2 + exit 1 + ;; +esac h=${h##* } +# trailing dot in a hostname will mess up rsync +h=${h%.} echo $h