From 40033f2595d2a36c814efaed772d49d9e9ee799b Mon Sep 17 00:00:00 2001 From: cajus Date: Mon, 6 Nov 2006 09:08:18 +0000 Subject: [PATCH] Added net-resolver for network autoconf git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5014 594d385d-05f5-0310-b6e9-bd551577e9d8 --- contrib/scripts/net-resolver.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 contrib/scripts/net-resolver.sh diff --git a/contrib/scripts/net-resolver.sh b/contrib/scripts/net-resolver.sh new file mode 100755 index 000000000..98364c271 --- /dev/null +++ b/contrib/scripts/net-resolver.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# Check for number of parameters +if [ $# -ne 1 ]; then + echo Usage: $(basename $0) dns-name + exit 1 +fi + +# Check for needed commands +for cmd in /usr/bin/host /usr/bin/fping /usr/sbin/arp; do + if [ ! -x $cmd ]; then + echo $cmd command not found - aborting + exit 2 + fi + eval $(echo ${cmd##*/}=$cmd) +done + +mac="" +ip=$(LANG=C $host $1 | grep address | head -n1 | sed 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/g') +if $fping -c1 -r3 -t500 $ip &> /dev/null; then + mac=$($arp -n | awk "/^$ip/ {print \$3}") +fi +echo "$ip;$mac" -- 2.30.2