X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=etc%2Fgrml%2Fpump-scripts.d%2Fset-hostname;h=6682d3eb2750bb258c2480b77cbd1f105691c3e6;hp=f4b46d125fffbec50a5e63d07b522f5d0abb19fa;hb=f45a562882b4dd66c64db285900efbf18194ccf4;hpb=af61464c30dad6bffe1a24d421643c5a26942217 diff --git a/etc/grml/pump-scripts.d/set-hostname b/etc/grml/pump-scripts.d/set-hostname index f4b46d1..6682d3e 100755 --- a/etc/grml/pump-scripts.d/set-hostname +++ b/etc/grml/pump-scripts.d/set-hostname @@ -13,12 +13,9 @@ # and if running in live mode if ! checkbootparam 'nodhcphostname' && [ -f /etc/grml_cd ] ; then - hostname=$(host $3) || exit 1 - # dhcphostname is set, get the PTR for the ip - hostname=$(echo ${hostname} | awk '{ print substr($5, 0, length($5)-1) }') + hostname=$(busybox nslookup "$3" | awk '/Address 1: '$3'/ {print $4}') + [ -n "$hostname" ] || exit 1 - if [ -n "$hostname" ] ; then - grml-hostname $hostname - hostname -F /etc/hostname - fi + grml-hostname "$hostname" + hostname -F /etc/hostname fi