A simple service to listen for geoclue events and log them to PostgreSQL.
In order to build this program, the GeoClue, GLib, and libpq development headers must be installed.
On Debian / Ubuntu, they are in the packages libgeoclue-2-dev
,
libglib2.0-dev
, and libpq-dev
, respectively:
$ sudo apt install libgeoclue-2-dev libglib2.0-dev libpq-dev
In order for the application to have access to the GeoClue service, you must customize and install the desktop file:
$ mkdir -p ~/.local/share/applications/
$ cp geoclue-psql.desktop.template ~/.local/share/applications/geoclue-psql.desktop
Then, edit the file to set the full path of the executable.
This project uses the CMake build system.
$ mkdir build
$ cd build
$ cmake ..
$ make
Create a PostgreSQL database, and run schema.sql
.
For example, on Debian/Ubuntu, to prepare a database called geoclue
:
$ sudo -u postgres createdb --owner=$(whoami) geoclue
$ psql geoclue < schema.sql
The application looks at the DATABASE_URL
environment variable,
which should be a
libpq connection string,
such as postgres:///geoclue
.
Copy the .env.template
to .env
, edit it, and source it:
$ cp .env.template .env
$ vim .env
$ source .env
Then, run the built program:
$ ./geoclue-psql