]> git.sesse.net Git - plocate/commitdiff
Make update-plocate.sh work properly if installed to /usr.
authorSteinar H. Gunderson <steinar+git@gunderson.no>
Sun, 11 Oct 2020 22:22:38 +0000 (00:22 +0200)
committerSteinar H. Gunderson <steinar+git@gunderson.no>
Sun, 11 Oct 2020 22:22:38 +0000 (00:22 +0200)
meson.build
update-plocate.sh

index 8a67ae7eecae902131710ea7df1a8bbc8facde8d..3521fd55db57e86fa9c7efda0d9e8b40b3185324 100644 (file)
@@ -20,6 +20,12 @@ executable('plocate-build', 'plocate-build.cpp',
        install: true,
        install_dir: get_option('sbindir'))
 
+conf_data = configuration_data()
+conf_data.set('sbindir', get_option('prefix') + '/' + get_option('sbindir'))
+configure_file(input: 'update-plocate.sh',
+               output: 'update-plocate.sh',
+               configuration: conf_data)
+
 install_data('update-plocate.sh',
        install_dir: '/etc/cron.daily',
        rename: 'plocate')
index 3f88c7deb18fb3d2127f64bd429c93fda2abc5a6..2c1e2d8cd8efb38eed1d910acbc6e2c1d5cdaa09 100755 (executable)
@@ -2,6 +2,9 @@
 
 set -e
 
-/usr/local/sbin/plocate-build /var/lib/mlocate/mlocate.db /var/lib/mlocate/plocate.db.new
+SBINDIR=@sbindir@
+[ -d $SBINDIR ] || SBINDIR=/usr/local/sbin  # Default if not processed by Meson.
+
+$SBINDIR/plocate-build /var/lib/mlocate/mlocate.db /var/lib/mlocate/plocate.db.new
 chgrp mlocate /var/lib/mlocate/plocate.db.new
 mv /var/lib/mlocate/plocate.db.new /var/lib/mlocate/plocate.db