iopsys-feed/ponmngr/files/etc/uci-defaults/60-pon-generate
2021-12-14 06:03:10 +00:00

27 lines
943 B
Bash
Executable file

#!/bin/sh
basemac="$(db -q get hw.board.basemac | tr -d ':')"
if [ -s "/etc/config/pon" ]; then
if uci -q get pon.globals >/dev/null; then
# return if there is any valid content
exit
else
rm -f /etc/config/pon
fi
fi
touch /etc/config/pon
mac=''
if [ -z "$basemac" ]; then
mac="12345678"
else
# read last 8 characters of basemac without :
mac=${basemac: -8}
fi
uci set pon.globals=globals
uci set pon.globals.enabled="1"
uci set pon.globals.serial_number="BRCM$mac"
uci commit pon