diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig index 36cdffdb..9eed5ff9 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig @@ -15,10 +15,15 @@ get_primary_mac() { esac } +iface_exists() { + local name="$1" + ip link show dev "${name//.*/}" >/dev/null 2>&1 +} + lan_ifname="$(uci get network.lan.ifname)" wan_ifname="$(uci get network.wan.ifname)" -if [ -n "$wan_ifname" ]; then +if [ -n "$wan_ifname" ] && iface_exists "$wan_ifname"; then [ -z "$lan_ifname" ] || sysconfig_set lan_ifname "$lan_ifname" sysconfig_set wan_ifname "$wan_ifname" else diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network index 400cb40d..b335913a 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network @@ -7,7 +7,10 @@ uci_remove network lan +uci_remove network wan +uci_add network interface wan +uci_set network wan ifname "$(sysconfig wan_ifname)" uci_set network wan type 'bridge' uci_set network wan proto 'dhcp'