|
|
@ -294,34 +294,65 @@ configure_network()
|
|
|
|
deactivate_network()
|
|
|
|
deactivate_network()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
. /etc/os-release
|
|
|
|
. /etc/os-release
|
|
|
|
if [ $ID = "ubuntu" ]; then
|
|
|
|
|
|
|
|
IFACES=`/sbin/ifquery --list -a`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i in $IFACES; do
|
|
|
|
case "$ID" in
|
|
|
|
if [ $i != 'lo' ]; then
|
|
|
|
'ubuntu')
|
|
|
|
/sbin/ifdown $i
|
|
|
|
IFACES=$(/sbin/ifquery --list -a)
|
|
|
|
/sbin/ip addr flush dev $i
|
|
|
|
|
|
|
|
fi
|
|
|
|
for i in $IFACES; do
|
|
|
|
done
|
|
|
|
if [ $i != 'lo' ]; then
|
|
|
|
else
|
|
|
|
/sbin/ifdown $i
|
|
|
|
service networking stop
|
|
|
|
/sbin/ip addr flush dev $i
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
'alpine')
|
|
|
|
|
|
|
|
service networking stop || true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#IFACES=$(ip a | \
|
|
|
|
|
|
|
|
# sed -n 's#^[0-9]\+:[[:space:]]\+\([^:]\+\):[[:space:]].*#\1#p')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# took from find_ifaces in the networking service
|
|
|
|
|
|
|
|
IFACES=$(\
|
|
|
|
|
|
|
|
awk '$1 == "auto" {
|
|
|
|
|
|
|
|
for (i = 2; i <= NF; i = i + 1) printf("%s ", $i)
|
|
|
|
|
|
|
|
}' /etc/network/interfaces)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i in $IFACES; do
|
|
|
|
|
|
|
|
if [ $i != 'lo' ]; then
|
|
|
|
|
|
|
|
/sbin/ip link set dev $i down || true
|
|
|
|
|
|
|
|
/sbin/ip addr flush dev $i || true
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
|
|
|
|
service networking stop
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
activate_network()
|
|
|
|
activate_network()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
. /etc/os-release
|
|
|
|
. /etc/os-release
|
|
|
|
if [ $ID = "ubuntu" ]; then
|
|
|
|
|
|
|
|
IFACES=`/sbin/ifquery --list -a`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i in $IFACES; do
|
|
|
|
case "$ID" in
|
|
|
|
/sbin/ifup $i
|
|
|
|
'ubuntu')
|
|
|
|
done
|
|
|
|
IFACES=$(/sbin/ifquery --list -a)
|
|
|
|
else
|
|
|
|
|
|
|
|
service networking stop
|
|
|
|
for i in $IFACES; do
|
|
|
|
sleep 1
|
|
|
|
/sbin/ifup $i
|
|
|
|
service networking start
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
'alpine')
|
|
|
|
|
|
|
|
deactivate_network
|
|
|
|
|
|
|
|
service networking start
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
|
|
|
|
service networking stop
|
|
|
|
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
service networking start
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ $ACTION == "reconfigure" ] && deactivate_network
|
|
|
|
[ $ACTION == "reconfigure" ] && deactivate_network
|
|
|
|