]> git.sesse.net Git - plocate/commitdiff
Add some options for controlling installation and processing of the cron.daily script.
authorSteinar H. Gunderson <steinar+git@gunderson.no>
Wed, 14 Oct 2020 21:31:08 +0000 (23:31 +0200)
committerSteinar H. Gunderson <steinar+git@gunderson.no>
Wed, 14 Oct 2020 22:17:40 +0000 (00:17 +0200)
meson.build
meson_options.txt [new file with mode: 0644]
update-plocate.sh

index ba12c7b35b51a43061ae281a01fd5449d6fd806e..2e2761a78a3b1d91224bbac3a74446a56afe2c35 100644 (file)
@@ -21,14 +21,18 @@ executable('plocate-build', 'plocate-build.cpp',
        install_dir: get_option('sbindir'))
 
 conf_data = configuration_data()
+conf_data.set('PROCESSED_BY_MESON', '1')
 conf_data.set('sbindir', get_option('prefix') + '/' + get_option('sbindir'))
+conf_data.set('locategroup', get_option('locategroup'))
 update_script = configure_file(input: 'update-plocate.sh',
                output: 'update-plocate.sh',
                configuration: conf_data)
 
-install_data(update_script,
-       install_dir: '/etc/cron.daily',
-       rename: 'plocate')
+if get_option('install_cron')
+       install_data(update_script,
+               install_dir: '/etc/cron.daily',
+               rename: 'plocate')
+endif
 install_man('plocate.1')
 install_man('plocate-build.8')
 
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644 (file)
index 0000000..4bc9bd8
--- /dev/null
@@ -0,0 +1,2 @@
+option('install_cron', type: 'boolean', value: true, description: 'Install update script into /etc/cron.daily')
+option('locategroup', type: 'string', value: 'mlocate', description: 'Group that the install script will use for the .db file')
index 2c1e2d8cd8efb38eed1d910acbc6e2c1d5cdaa09..d4bafc31f889ea7a4204e295b7a1f69ef3d5fb86 100755 (executable)
@@ -2,9 +2,14 @@
 
 set -e
 
-SBINDIR=@sbindir@
-[ -d $SBINDIR ] || SBINDIR=/usr/local/sbin  # Default if not processed by Meson.
+if [ @PROCESSED_BY_MESON@ = 1 ]; then
+       SBINDIR=@sbindir@
+       LOCATEGROUP=@locategroup@
+else
+       SBINDIR=/usr/local/sbin
+       LOCATEGROUP=mlocate
+fi
 
 $SBINDIR/plocate-build /var/lib/mlocate/mlocate.db /var/lib/mlocate/plocate.db.new
-chgrp mlocate /var/lib/mlocate/plocate.db.new
+chgrp $LOCATEGROUP /var/lib/mlocate/plocate.db.new
 mv /var/lib/mlocate/plocate.db.new /var/lib/mlocate/plocate.db