ponmngr: use iopsys-environment for reading production data

U-Boot environment is kept as a fallback for legacy reasons.
This commit is contained in:
Erik Karlsson 2025-09-17 14:13:15 +02:00
parent da727b4dc1
commit 6980c1e2e5

17
ponmngr/files/common/etc/uci-defaults/60-xpon-generate Executable file → Normal file
View file

@ -1,10 +1,13 @@
#!/bin/sh #!/bin/sh
. /lib/functions/system.sh . /lib/functions/system.sh
. /lib/functions/iopsys-environment.sh
configure_serial_number() { configure_serial_number() {
# check if serial number is present in the production data # check if serial number is present in the production data
local production_sn="$(fw_printenv -n gponsn)" local production_sn="$(get_xpon_serial 2>/dev/null)"
[ ${#production_sn} -eq 12 ] || production_sn="$(fw_printenv -n gponsn)"
if [ ${#production_sn} -eq 12 ]; then if [ ${#production_sn} -eq 12 ]; then
uci set xpon.ani.serial_number="${production_sn}" uci set xpon.ani.serial_number="${production_sn}"
else else
@ -21,8 +24,10 @@ configure_ploam_password() {
local passwd="$(uci -q get xpon.ani.ploam_password)" local passwd="$(uci -q get xpon.ani.ploam_password)"
if [ -z "${passwd}" ]; then if [ -z "${passwd}" ]; then
local production_passwd="$(fw_printenv -n gponpswd)" local production_passwd="$(get_xpon_password 2>/dev/null)"
if [ -n ${#production_passwd} ]; then [ -n "${production_passwd}" ] || production_passwd="$(fw_printenv -n gponpswd)"
if [ -n "${production_passwd}" ]; then
uci set xpon.ani.ploam_password="${production_passwd}" uci set xpon.ani.ploam_password="${production_passwd}"
uci set xpon.ani.ploam_hexadecimalpassword=0 uci set xpon.ani.ploam_hexadecimalpassword=0
fi fi
@ -37,10 +42,12 @@ configure_loid_authentication() {
local loidpwd="$(uci -q get xpon.ani.loid_password)" local loidpwd="$(uci -q get xpon.ani.loid_password)"
if [ -z "${loid}" ]; then if [ -z "${loid}" ]; then
production_loid="$(fw_printenv -n gponloid)" production_loid="$(get_xpon_loid 2>/dev/null)"
[ -n "${production_loid}" ] || production_loid="$(fw_printenv -n gponloid)"
fi fi
if [ -z "${loidpwd}" ]; then if [ -z "${loidpwd}" ]; then
production_loidpwd="$(fw_printenv -n gponloid_password)" production_loidpwd="$(get_xpon_loid_password 2>/dev/null)"
[ -n "${production_loidpwd}" ] || production_loidpwd="$(fw_printenv -n gponloid_password)"
fi fi
if [ -n "${production_loid}" ]; then if [ -n "${production_loid}" ]; then