2011-04-26 12:26:24 +02:00
|
|
|
#!/bin/bash
|
2012-03-13 14:53:02 +01:00
|
|
|
# Copyright (c) 2003-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
2013-02-21 21:30:24 +01:00
|
|
|
# Copyright (c) 2003-2009,2013 by Davide Madrisan <davide.madrisan@gmail.com>
|
2011-04-26 12:26:24 +02:00
|
|
|
|
|
|
|
. /etc/sysconfig/rc
|
|
|
|
. $rc_functions
|
|
|
|
|
|
|
|
DEVICE=${1}
|
|
|
|
|
2013-02-21 21:30:24 +01:00
|
|
|
if [ -z "$DEVICE" ]; then
|
|
|
|
echo "Usage: ifdown <device name>" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2011-04-26 12:26:24 +02:00
|
|
|
|
2012-03-13 14:53:02 +01:00
|
|
|
[ "$NM_CONTROLLED" = "0" ] || exit 0
|
|
|
|
|
2011-04-27 19:48:38 +02:00
|
|
|
[ -r $network_devices/ifcfg-${DEVICE} ] &&
|
|
|
|
. $network_devices/ifcfg-${DEVICE}
|
2011-04-26 12:26:24 +02:00
|
|
|
|
|
|
|
if [ -x $network_devices/ifdown-${DEVICE} ]; then
|
|
|
|
$network_devices/ifdown-${DEVICE}
|
|
|
|
else
|
|
|
|
if [ -r /var/run/wpa_supplicant/${DEVICE} ]; then
|
|
|
|
wpa_cli -i${DEVICE} terminate >/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -r /var/run/dhclient.${DEVICE}.pid ]; then
|
|
|
|
/sbin/dhclient ${DEVICE} -r -pf /var/run/dhclient.${DEVICE}.pid
|
|
|
|
kill -9 `cat /var/run/dhclient.${DEVICE}.pid` 2>/dev/null
|
|
|
|
rm -f /var/run/dhclient.${DEVICE}.pid
|
|
|
|
fi
|
|
|
|
|
|
|
|
/sbin/ifconfig ${DEVICE} down
|
|
|
|
fi
|