]> git.sesse.net Git - plocate/commitdiff
Put the database file in sharedstatedir.
authorSteinar H. Gunderson <steinar+git@gunderson.no>
Sat, 28 Nov 2020 20:05:56 +0000 (21:05 +0100)
committerSteinar H. Gunderson <steinar+git@gunderson.no>
Sat, 28 Nov 2020 20:05:56 +0000 (21:05 +0100)
meson.build
update-plocate.sh

index 1d53e94b61c421cefa7fb4a3fa124658f80c4292..f91668493c09fe4c43afdd7012167d1db82be93f 100644 (file)
@@ -2,7 +2,8 @@ project('plocate', 'cpp', default_options: ['buildtype=debugoptimized','cpp_std=
 
 add_project_arguments('-DGROUPNAME="' + get_option('locategroup') + '"', language: 'cpp')
 add_project_arguments('-DUPDATEDB_CONF="/etc/updatedb.conf"', language: 'cpp')
-add_project_arguments('-DDBFILE="/var/lib/plocate/plocate.db"', language: 'cpp')
+dbfile = join_paths(get_option('sharedstatedir'), 'plocate', 'plocate.db')
+add_project_arguments('-DDBFILE="' + dbfile + '"', language: 'cpp')
 add_project_arguments('-DPACKAGE_NAME="plocate"', language: 'cpp')
 add_project_arguments('-DPACKAGE_VERSION="' + meson.project_version() + '"', language: 'cpp')
 add_project_arguments('-DPACKAGE_BUGREPORT="steinar+plocate@gunderson.no"', language: 'cpp')
@@ -46,6 +47,7 @@ conf_data = configuration_data()
 conf_data.set('PROCESSED_BY_MESON', '1')
 conf_data.set('sbindir', join_paths(get_option('prefix'), get_option('sbindir')))
 conf_data.set('locategroup', get_option('locategroup'))
+conf_data.set('dbfile', dbfile)
 update_script = configure_file(input: 'update-plocate.sh',
                output: 'update-plocate.sh',
                configuration: conf_data)
index 5d7b402af56b4428a4fbee190444bca33b2d6f1f..d113a14781d80c7d236ad6fd614a19b03fc925b5 100755 (executable)
@@ -5,11 +5,13 @@ set -e
 if [ @PROCESSED_BY_MESON@ = 1 ]; then
        SBINDIR=@sbindir@
        LOCATEGROUP=@locategroup@
+       DBFILE=@dbfile@
 else
        SBINDIR=/usr/local/sbin
        LOCATEGROUP=plocate
+       DBFILE=/var/lib/plocate/plocate.db
 fi
 
-$SBINDIR/plocate-build /var/lib/mlocate/mlocate.db /var/lib/plocate/plocate.db.new
-chgrp $LOCATEGROUP /var/lib/plocate/plocate.db.new
-mv /var/lib/plocate/plocate.db.new /var/lib/plocate/plocate.db
+$SBINDIR/plocate-build /var/lib/mlocate/mlocate.db $DBFILE.new
+chgrp $LOCATEGROUP $DBFILE.new
+mv $DBFILE.new $DBFILE