diff --git a/package/gluon-core/files/lib/gluon/core/sysconfig/.keep b/package/gluon-core/files/lib/gluon/core/sysconfig/.keep new file mode 100644 index 00000000..e69de29b diff --git a/package/gluon-core/files/lib/gluon/functions/sysconfig.sh b/package/gluon-core/files/lib/gluon/functions/sysconfig.sh new file mode 100644 index 00000000..40acf689 --- /dev/null +++ b/package/gluon-core/files/lib/gluon/functions/sysconfig.sh @@ -0,0 +1,10 @@ +SYSCONFIGDIR=/lib/gluon/core/sysconfig + + +sysconfig() { + cat "$SYSCONFIGDIR/$1" +} + +sysconfig_set() { + echo -n "$2" > "$SYSCONFIGDIR/$1" +} 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 new file mode 100644 index 00000000..1affcb46 --- /dev/null +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig @@ -0,0 +1,20 @@ +#!/bin/sh + +. /lib/gluon/functions/sysconfig.sh +. /lib/ar71xx.sh + + +get_primary_mac() { + case "$(ar71xx_board_name)" in + tl-wdr3600|tl-wdr4300) + cat /sys/class/ieee80211/phy1/macaddress + ;; + *) + cat /sys/class/ieee80211/phy0/macaddress + ;; + esac +} + + +sysconfig_set lan_ifname "$(uci get network.lan.ifname)" +sysconfig_set primary_mac "$(get_primary_mac)" 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 c2086228..28211d71 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 @@ -1,9 +1,7 @@ #!/bin/sh -. /lib/ar71xx.sh -local lan_ifname="$(uci get network.lan.ifname)" -local board="$(ar71xx_board_name)" +. /lib/gluon/functions/sysconfig.sh uci -q batch <