B #4439: fix Alpine networking

Signed-off-by: Petr Ospalý <pospaly@opennebula.systems>
pull/205/head
Petr Ospalý 5 years ago committed by Vlastimil Holer
parent cedee1c812
commit 8d5542c45e
No known key found for this signature in database
GPG Key ID: EB549BADEFD07C53

@ -294,8 +294,10 @@ configure_network()
deactivate_network() deactivate_network()
{ {
. /etc/os-release . /etc/os-release
if [ $ID = "ubuntu" ]; then
IFACES=`/sbin/ifquery --list -a` case "$ID" in
'ubuntu')
IFACES=$(/sbin/ifquery --list -a)
for i in $IFACES; do for i in $IFACES; do
if [ $i != 'lo' ]; then if [ $i != 'lo' ]; then
@ -303,25 +305,54 @@ deactivate_network()
/sbin/ip addr flush dev $i /sbin/ip addr flush dev $i
fi fi
done done
else ;;
service networking stop '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 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` case "$ID" in
'ubuntu')
IFACES=$(/sbin/ifquery --list -a)
for i in $IFACES; do for i in $IFACES; do
/sbin/ifup $i /sbin/ifup $i
done done
else ;;
'alpine')
deactivate_network
service networking start
;;
*)
service networking stop service networking stop
sleep 1 sleep 1
service networking start service networking start
fi ;;
esac
} }
[ $ACTION == "reconfigure" ] && deactivate_network [ $ACTION == "reconfigure" ] && deactivate_network

Loading…
Cancel
Save