-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Here's an improvement in the "MerlinAutoUpdate.sh" shell script for getting the router model ID. Instead of the current syntax:
MODEL=$(nvram get model)
Use the following function:
##################################################
GetRouterModel()
{
local retCode=1 routerModelID="N/A"
local nvramModelKeys="odmpid productid wps_modelnum wps_device_name model"
for nvramKey in $nvramModelKeys
do
routerModelID="$(nvram get "$nvramKey")"
[ -n "$routerModelID" ] && retCode=0 && break
done
echo "$routerModelID" ; return "$retCode"
}
##################################################
EXAMPLE USAGE:
if ! MODEL="$(GetRouterModel)"
then echo "ERROR: UNKNOWN Router Model" ; exit 1 ; fi
The reason is that not all ASUS routers use or set the "model" NVRAM variable; most use either "odmpid" or "productid" variable to store the router model ID. Other keys in the list could be used as well.