# Save opt72 address, comming from DHCP, into UCI

date | logger
logger "Script 61opt72."

loga(){
    logger "61opt72: $1"
    echo "61opt72: $1"
}


if [ -z "$opt72" ]; then
    loga "opt72 environment variable is empty."
    exit 0
else
    loga "opt72: $opt72"
fi

OPT72=`uci get informacast.dhcp.opt72`

if [ "$opt72" = "$OPT72" ]; then
    loga "Opt72 has not changed."
    exit 0
else
    loga "Opt72: $OPT72"
fi

uci set informacast.dhcp.opt72="$opt72"

if [ $? -eq 0 ]; then
    #No need to commit the changes
    #uci commit
    if [ $? -eq 0 ]; then
        exit 0;
    fi
fi

loga "Failed updating UCI with DHCP opt72."
exit 1
