#Put any uci system configuration here
TARGET_NAME="Trout"
uci set system.@system[0].hostname=$TARGET_NAME
uci set system.@system[0].target=$TARGET_NAME

GUID=$(uci -q get system.@system[0].guid)
if [ -z ${GUID} ]; then
    GUID=$(guid)
    uci set system.@system[0].guid=$GUID
fi

SERIAL=$(uci -q get system.@system[0].crypto_sn)
if [ -z ${SERIAL} ]; then
    SERIAL=$(crypto-cli sn)
    uci set system.@system[0].crypto_sn=$SERIAL
fi

#Set default password for the root user
passwd root <<EOP
admin
admin
EOP

uci commit system

exit 0
