summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorMaciej S. Szmigiero <maciej.szmigiero@oracle.com>2023-01-05 20:47:24 +0100
committerMaciej S. Szmigiero <maciej.szmigiero@oracle.com>2023-01-15 13:50:23 +0100
commitcb66669cff959046c8ef02abe13fc4f1a68660c5 (patch)
treed969ebeecb694d25b007068242916f435d77c7f0 /data
parent0cc334a44ed0384785379996e7f20e85f26e624f (diff)
downloadgeoclue-cb66669cff959046c8ef02abe13fc4f1a68660c5.tar.gz
Add static location source
There were many requests to provide a static location source for systems which don't normally move but where the existing location sources provide poor location estimate. An example of such system would be a desktop PC without WiFi or 3G modem. So let's add a source that reads location from "geolocation" file in @sysconfdir@ (normally /etc) to cover this use case. This file is constantly monitored for changes during Geoclue operation and the reported static location is updated accordingly. The geoclue(5) man page should be consulted for the format description of this file.
Diffstat (limited to 'data')
-rw-r--r--data/geoclue.5.in52
-rw-r--r--data/geoclue.conf.in13
-rw-r--r--data/meson.build1
3 files changed, 66 insertions, 0 deletions
diff --git a/data/geoclue.5.in b/data/geoclue.5.in
index 137dde1..cc7a099 100644
--- a/data/geoclue.5.in
+++ b/data/geoclue.5.in
@@ -98,6 +98,20 @@ Compass configuration options
.B \fBenable=true
.br
Enable Compass
+.br
+.IP \fB[static-source]
+.br
+Static source configuration options.
+.br
+This source reads location from "geolocation" file in @sysconfdir@. While this file is constantly monitored for changes during geoclue operation, and the reported static location is updated accordingly, this source isn't meant for inputting a dynamically changing location to geoclue (please use the Network NMEA source for that).
+.IP
+.B \fBenable=true
+.br
+Enable the static source.
+.br
+If you make use of this source, you probably should disable other location
+sources in geoclue.conf so they won't override the configured static location.
+.br
.SH APPLICATION CONFIGURATION OPTIONS
Having an entry here for an application with
.B allowed=true
@@ -179,6 +193,44 @@ system=false
.br
users=
.br
+.SH STATIC LOCATION FILE
+.SS Basic format:
+The static location file in @sysconfdir@ (used by the static source) is a text file consisting of the following:
+.nr step 1 1
+.IP \n[step]
+Latitude (floating point number; positive values mean north, negative south)
+.IP \n+[step]
+Longitude (floating point number; positive values mean east, negative west)
+.IP \n+[step]
+Altitude (floating point number; in meters)
+.IP \n+[step]
+Accuracy radius (floating point number; in meters)
+.RE
+.PP
+These values need to be separated by newline characters.
+.SS Additional format information:
+.IP \[bu]
+The '\[sh]' character starts a comment, which continues until the end of the current line.
+.IP \[bu]
+Leading and trailing white-space on each line is ignored.
+.IP \[bu]
+Empty lines (or containing just white-space or a comment) are ignored.
+.SS Example:
+.EX
+# Example static location file for a machine inside Statue of Liberty torch
+
+40.6893129 # latitude
+-74.0445531 # longitude
+96 # altitude
+1.83 # accuracy radius (the diameter of the torch is 12 feet)
+.EE
+.SS Notes:
+For extra security, the static location file can be made readable just by the geoclue user:
+.EX
+# chown @dbus_srv_user@ @sysconfdir@/geolocation
+# chmod 600 @sysconfdir@/geolocation
+.EE
+.br
.SH AUTHOR
.na
.nf
diff --git a/data/geoclue.conf.in b/data/geoclue.conf.in
index 8006cda..9afb5e0 100644
--- a/data/geoclue.conf.in
+++ b/data/geoclue.conf.in
@@ -43,6 +43,8 @@ enable=true
[wifi]
# Enable WiFi source
+# If this source and the static source below are both disabled a GeoIP-only
+# source will be used instead.
enable=true
# URL to the WiFi geolocation service. If not set, defaults to Mozilla's
@@ -86,6 +88,17 @@ submission-nick=geoclue
# Enable Compass
enable=true
+# Static source configuration options
+#
+# This source reads location from "geolocation" file in @sysconfdir@ - please
+# consult geoclue(5) man page for the format description of this file.
+[static-source]
+
+# Enable the static source
+# If you make use of this source, you probably should disable other location
+# sources in this file so they won't override the configured static location.
+enable=true
+
# Application configuration options
#
# NOTE: Having an entry here for an application with allowed=true means that
diff --git a/data/meson.build b/data/meson.build
index a1fc61f..fc8dac5 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,5 +1,6 @@
if get_option('enable-backend')
conf = configuration_data()
+ conf.set('sysconfdir', sysconfdir)
if get_option('demo-agent')
conf.set('demo_agent', 'geoclue-demo-agent;')