From b6484440e1eeb15d4cdb81893599048a5d31fd31 Mon Sep 17 00:00:00 2001
From: Nils Schneider <nils@nilsschneider.net>
Date: Wed, 2 Oct 2013 14:18:42 +0200
Subject: [PATCH] gluon-location: store lat/lon in system config

---
 package/gluon-location/Makefile               | 36 +++++++++++++++++++
 .../upgrade/location/initial/010-location     | 12 +++++++
 2 files changed, 48 insertions(+)
 create mode 100644 package/gluon-location/Makefile
 create mode 100755 package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location

diff --git a/package/gluon-location/Makefile b/package/gluon-location/Makefile
new file mode 100644
index 000000000..d9cdf3ebf
--- /dev/null
+++ b/package/gluon-location/Makefile
@@ -0,0 +1,36 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=gluon-location
+PKG_VERSION:=1
+PKG_location:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gluon-location
+  SECTION:=gluon
+  CATEGORY:=Gluon
+  TITLE:=Add system.location to uci
+  DEPENDS:=+gluon-core
+endef
+
+define Package/gluon-location/description
+	This packages creates /lib/gluon/location.
+endef
+
+define Build/Prepare
+	mkdir -p $(PKG_BUILD_DIR)
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/gluon-location/install
+	$(CP) ./files/* $(1)/
+endef
+
+$(eval $(call BuildPackage,gluon-location))
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
new file mode 100755
index 000000000..9a2696d27
--- /dev/null
+++ b/package/gluon-location/files/lib/gluon/upgrade/location/initial/010-location
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+CFG="@system[0]"
+
+uci -q batch <<EOF
+
+set system.${CFG}.share_location=0
+set system.${CFG}.latitude=0
+set system.${CFG}.longitude=0
+
+commit system
+EOF
-- 
GitLab