various fixes and improvements
[automated-distro-installer] / fai-redep
index 29f4d158c5e832597e599db83cf97b408a0bbe12..97302608703b55acb479795740e663e12e3a79de 100755 (executable)
--- a/fai-redep
+++ b/fai-redep
@@ -10,21 +10,10 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 cd $(dirname $(readlink -f "$BASH_SOURCE"))
 
 
-faiserver_host=faiserver
 # i use faiserver as a dns alias, but ssh key is associated with
 # a canonical hostname and we will have ssh warning spam unless we
 # use it, so look it up.
-if addr=$(host faiserver); then
-    addr=${addr##* }
-    if h=$(host $addr); then
-        h=${h##* }
-        faiserver_host=${h%%.*}
-    else
-        echo "$0: warning: host \$addr($addr) failed"
-    fi
-else
-    echo "$0: warning: host faiserver failed"
-fi
+faiserver_host=$(chost faiserver) || faiserver_host=faiserver
 
 
 ssh root@$faiserver_host rm -rf /srv/fai/config