X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=scripts%2Fifdown;h=836feffe9782d7d77e7be7a3eecef497f504ecc0;hb=8ab370eace6aeb1e067fb4175187fd4d7b1235c1;hp=784b1e28d4dbbeacf3459c099fa0096873bdcefc;hpb=9ea1bff7b049ce152767460c68bb61f6aa500cef;p=startuptools diff --git a/scripts/ifdown b/scripts/ifdown index 784b1e2..836feff 100755 --- a/scripts/ifdown +++ b/scripts/ifdown @@ -2,10 +2,10 @@ net=$1 +saveifs="$IFS" IFS=';' -# TODO allow for /etc/sysconfig/$net also -test -f /etc/sysconfig/$net.net || echo "unknown network configuration '$net'" >&2 && exit 1 +test -f /etc/networks/$net || (echo "unknown network configuration '$net'" >&2 && exit 1) ifdown_post() { return 0 @@ -15,21 +15,29 @@ ifdown_pre() { return 0 } -. /etc/sysconfig/$net.net +. /etc/networks/$net -#if [ $enable = 'no' || $enable -eq 0 ]; then; exit 0; fi +if [ "$enable" = 'no' ]; then exit 0; fi ifdown_pre #ip link set dev $dev up for r in $route; do + IFS="$saveifs" ip route del $r + IFS=';' done -for address in $addr do - ip addr del $address dev $dev -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