diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh index 65e4b187..1788af48 100755 --- a/package/gluon-alfred/files/lib/gluon/alfred/announce.sh +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.sh @@ -21,10 +21,10 @@ set -e json_init json_add_string "hostname" "$(uci get 'system.@system[0].hostname')" -if [ "$(uci -q get 'system.@system[0].share_location')" = 1 ]; then +if [ "$(uci -q get 'gluon-location.@location[0].share_location')" = 1 ]; then json_add_object "location" - json_add_double "latitude" "$(uci get 'system.@system[0].latitude')" - json_add_double "longitude" "$(uci get 'system.@system[0].longitude')" + json_add_double "latitude" "$(uci get 'gluon-location.@location[0].latitude')" + json_add_double "longitude" "$(uci get 'gluon-location.@location[0].longitude')" json_close_object # location fi diff --git a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua index 4b69ef01..4d8898bd 100644 --- a/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode/files/usr/lib/lua/luci/model/cbi/gluon-config-mode/wizard.lua @@ -45,16 +45,16 @@ o.datatype = "integer" s = f:section(SimpleSection, "GPS Koordinaten", "Hier kannst du die GPS-Koordinaten deines Knotens eintragen, um ihn in der Knotenkarte anzeigen zu lassen.") o = s:option(Flag, "_location", "Koordinaten veröffentlichen?") -o.default = uci:get_first("system", "system", "share_location", o.disabled) +o.default = uci:get_first("gluon-locaton", "location", "share_location", o.disabled) o.rmempty = false o = s:option(Value, "_latitude", "Breitengrad") -o.default = string.format("%f", uci:get_first("system", "system", "latitude", "0")) +o.default = string.format("%f", uci:get_first("gluon-location", "location", "latitude", "0")) o.rmempty = false o.datatype = "float" o = s:option(Value, "_longitude", "Längengrad") -o.default = string.format("%f", uci:get_first("system", "system", "longitude", "0")) +o.default = string.format("%f", uci:get_first("gluon-location", "location", "longitude", "0")) o.rmempty = false o.datatype = "float" @@ -79,13 +79,18 @@ function f.handle(self, state, data) uci:foreach("system", "system", function(s) uci:set("system", s[".name"], "hostname", data._hostname) - uci:set("system", s[".name"], "share_location", data._location) - uci:set("system", s[".name"], "latitude", data._latitude) - uci:set("system", s[".name"], "longitude", data._longitude) end) uci:save("system") uci:commit("system") + uci:foreach("gluon-location", "location", function(s) + uci:set("gluon-location", s[".name"], "share_location", data._location) + uci:set("gluon-location", s[".name"], "latitude", data._latitude) + uci:set("gluon-location", s[".name"], "longitude", data._longitude) + end) + uci:save("gluon-location") + uci:commit("gluon-location") + luci.http.redirect(luci.dispatcher.build_url("gluon-config-mode", "reboot")) end diff --git a/package/gluon-location/Makefile b/package/gluon-location/Makefile index 7f1feb62..f1dd7352 100644 --- a/package/gluon-location/Makefile +++ b/package/gluon-location/Makefile @@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/package.mk define Package/gluon-location SECTION:=gluon CATEGORY:=Gluon - TITLE:=Add system.location to uci + TITLE:=Add /etc/config/gluon-location to uci DEPENDS:=+gluon-core endef define Package/gluon-location/description - This packages creates /lib/gluon/location. + This packages creates /etc/config/gluon-location. endef define Build/Prepare diff --git a/package/gluon-location/files/etc/config/gluon-location b/package/gluon-location/files/etc/config/gluon-location new file mode 100644 index 00000000..3b102cae --- /dev/null +++ b/package/gluon-location/files/etc/config/gluon-location @@ -0,0 +1,4 @@ +config location + option share_location '0' + option latitude '0.000000' + option longitude '0.000000' diff --git a/package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location b/package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location deleted file mode 100755 index 9a2696d2..00000000 --- a/package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -CFG="@system[0]" - -uci -q batch <