]> pd.if.org Git - startuptools/commitdiff
Added dhcp support to interface scripts
authorNathan Wagner <nw@hydaspes.if.org>
Tue, 28 May 2013 07:58:16 +0000 (07:58 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Tue, 28 May 2013 07:58:16 +0000 (07:58 +0000)
scripts/ifdown
scripts/ifup

index fa92831c408d314ec04e8488a27a6dd026975dd8..836feffe9782d7d77e7be7a3eecef497f504ecc0 100755 (executable)
@@ -17,8 +17,7 @@ ifdown_pre() {
 
 . /etc/networks/$net
 
-if [ $enable = 'no' ]; then exit 0; fi
-#if [ $enable -eq 0 ]; then exit 0; fi
+if [ "$enable" = 'no' ]; then exit 0; fi
 
 ifdown_pre
 
@@ -30,11 +29,15 @@ for r in $route; do
        IFS=';'
 done
 
-for address in $addr do
-       IFS="$saveifs"
-       ip addr del $address dev $dev
-       IFS=';'
-done
+if [ "$addr" = 'dhcp' ]; then
+       /sbin/dhcpcd -q -k $dev
+else
+       for address in $addr; do
+               IFS="$saveifs"
+               ip addr del $address dev $dev
+               IFS=';'
+       done
+fi
 
 # how do we determine if we should bring the link down?
 # there could be other configurations that also set up IP
index d5489b1ef7f52521e8c4fd9d70371a9159abe383..149cb17a69f20ec1b9cfb9d5f0c76474dd2b0f6e 100755 (executable)
@@ -24,11 +24,15 @@ ifup_pre
 
 ip link set dev $dev up
 
-for address in $addr; do
-       IFS="$saveifs"
-       ip addr add $address dev $dev
-       IFS=';'
-done
+if [ "$addr" = 'dhcp' ]; then
+       /sbin/dhcpcd -q $dev
+else
+       for address in $addr; do
+               IFS="$saveifs"
+               ip addr add $address dev $dev
+               IFS=';'
+       done
+fi
 
 for r in $route; do
        IFS="$saveifs"