X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=chost;h=204637b003852d21d7c661b966f41e9a69d73ae5;hb=d9993568d38dd7d2d18ced6b5007e9cc07d1e576;hp=a26529fee9efbeaf3a14632946d59d4e84d7bc8d;hpb=591c84435e22df12f2b5121c08578bff7c6bb047;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