tweak example udhcp script
authorDenis Vlasenko <vda.linux@googlemail.com>
Tue, 21 Apr 2009 00:17:00 +0000 (00:17 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Tue, 21 Apr 2009 00:17:00 +0000 (00:17 -0000)
examples/udhcp/simple.script

index ae093164092c8b86ab9bc272a893b6c27f0d0d79..abf1b6f26a48d5174444d2c721dc72b43bdbf43c 100644 (file)
@@ -1,10 +1,10 @@
 #!/bin/sh
-
 # udhcpc script edited by Tim Riker <Tim@Rikers.org>
 
-[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
-
 RESOLV_CONF="/etc/resolv.conf"
+
+[ -n "$1" ] || echo "Error: should be called from udhcpc" && exit 1
+
 NETMASK=""
 [ -n "$subnet" ] && NETMASK="netmask $subnet"
 BROADCAST="broadcast +"
@@ -35,10 +35,10 @@ case "$1" in
 
                echo "Recreating $RESOLV_CONF"
                echo -n > $RESOLV_CONF-$$
-               [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF-$$
+               [ -n "$domain" ] && echo "search $domain" >> $RESOLV_CONF-$$
                for i in $dns ; do
                        echo " Adding DNS server $i"
-                       echo nameserver $i >> $RESOLV_CONF-$$
+                       echo "nameserver $i" >> $RESOLV_CONF-$$
                done
                mv $RESOLV_CONF-$$ $RESOLV_CONF
                ;;