Skip to content

Commit

Permalink
seperate network config restore; add restart network after restore
Browse files Browse the repository at this point in the history
  • Loading branch information
WanWizard committed Jan 2, 2023
1 parent 2ee92e9 commit b87db1c
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions tools/enigma2.sh.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
#!/bin/sh

function restartNetwork
{
# stop network services
/etc/init.d/avahi-daemon stop
/etc/init.d/networking stop
killall -9 udhcpc
rm /var/run/udhcpc*

# enumerate network interfaces
local ifaces=`ip link | awk -F: '$0 !~ "lo|vir|^[^0-9]"{print $2;getline}'`

# force the interfaces down and flush them
for iface in $ifaces; do
ifdown $iface
ip addr flush dev $iface scope global
done

# restart the services
/etc/init.d/dbus-1 reload
/etc/init.d/networking start
/etc/init.d/avahi-daemon start

# wait until we have a network again
echo "**** Waiting for network ****"
for i in {1..60}; do
gw=`netstat -rn | grep UG | awk '{print $2}'`
if [ ! -z "$gw" ]; then
echo "> Online !"
break
fi
sleep 1
done
}

prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
Expand Down Expand Up @@ -64,8 +98,9 @@ while : ; do
# 5 - install new settings
# 6 - restart enigma in debug mode
# 7 - manufacturer reset
# 42 - offline update
# 43 - restart for autoinstall
# 42 - restart for unattended update
# 43 - restart for autobackup restore
# 44 - restart for autobackup network restore
#
# >128 signal

Expand Down Expand Up @@ -125,10 +160,19 @@ while : ; do
/sbin/reboot
;;
43)
#auto install and autobackup
# restore a full autobackup
[ -f /sys/class/vtconsole/vtcon1/bind ] && echo 1 > /sys/class/vtconsole/vtcon1/bind
/etc/init.d/settings-restore.sh
/etc/init.d/softcam restart
restartNetwork
[ -f /etc/init.d/softcam ] && /etc/init.d/softcam restart
break
;;
44)
# restore network settings from the backup
[ -f /sys/class/vtconsole/vtcon1/bind ] && echo 1 > /sys/class/vtconsole/vtcon1/bind
/etc/init.d/settings-restore.sh network
restartNetwork
[ -f /etc/init.d/softcam ] && /etc/init.d/softcam restart
break
;;
*)
Expand Down

0 comments on commit b87db1c

Please sign in to comment.