Add widget config from community profile to meshwizard
[project/luci.git] / contrib / package / meshwizard / files / usr / bin / meshwizard / helpers / setup_widgets.sh
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_widgets.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_widgets.sh
new file mode 100755 (executable)
index 0000000..288252f
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+. /lib/functions.sh
+ . $dir/functions.sh
+
+if [ -n "$widgets" ]; then
+       [ ! -f "/etc/config/freifunk-widgets" ] && touch /etc/config/freifunk-widgets
+       for w in $widgets; do
+               uci set freifunk-widgets.${w}=widget
+               set_defaults "${w}_" freifunk-widgets.${w}
+               uci delete profile_$community.${w}
+       done
+       uci commit profile_$community
+       uci_commitverbose "Added widget config." freifunk-widgets
+fi