X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=contrib%2Fpackage%2Fmeshwizard%2Ffiles%2Fusr%2Fbin%2Fmeshwizard%2Fhelpers%2Finitial_config.sh;fp=contrib%2Fpackage%2Fmeshwizard%2Ffiles%2Fusr%2Fbin%2Fmeshwizard%2Fhelpers%2Finitial_config.sh;h=a5f670dd5fb57a60094f4323048fef4d88915cd0;hb=ab87896104be09072ccccad305588d46370ab5ad;hp=0000000000000000000000000000000000000000;hpb=e88fd858a1c0d3dbac4703224dc63cb498839432;p=project%2Fluci.git diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/initial_config.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/initial_config.sh new file mode 100755 index 0000000000..a5f670dd5f --- /dev/null +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/initial_config.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# This is only run once (usually after flashing an image from the imagebuilder) +# It sets up the initial config for this node. + + +. /etc/functions.sh +. $dir/functions.sh + +### System config + +config_load system + +# Rename system config +handle_system() { + if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then + section_rename system $1 system + fi +} +config_foreach handle_system system + +if [ -n "$(uci -q get meshwizard.system)" ]; then + echo " + Setup system" + uci show meshwizard.system | sed 's/^meshwizard/uci set system/g' | while read line; do + eval $line + echo " $line" + done + uci -q delete meshwizard.system +fi + +if [ -n "$(uci -q get meshwizard.community)" ]; then + echo " + Setup community" + uci show meshwizard.community | sed 's/^meshwizard/freifunk/g' | while read line; do + eval uci set $line + echo " $line" + done + uci -q delete meshwizard.community +fi + +if [ -n "$(uci -q get meshwizard.contact)" ]; then + echo " + Setup contact" + uci show meshwizard.contact | sed 's/^meshwizard/freifunk/g' | while read line; do + eval uci set $line + echo " $line" + done + uci -q delete meshwizard.contact +fi + +if [ -n "$(uci -q get meshwizard.luci_main)" ]; then + echo " + Setup luci" + uci show meshwizard.luci_main |sed -e 's/^meshwizard/luci/g' -e 's/luci_main/main/' | while read line; do + eval uci set $line + echo " $line" + done + uci -q delete meshwizard.luci_main +fi + +uci commit + +