From d8b761f706a9f3d317f90fddfba7537fd81deedf Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 21 Jun 2021 21:21:53 +0200 Subject: [PATCH] Make it possible to set systemunitdir explicitly. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This allows a distributor to hard-code the systemd unit directory instead of relying on systemd-dev. Based on a patch by Zbigniew Jędrzejewski-Szmek. --- meson.build | 17 +++++++++-------- meson_options.txt | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index 19de67b..16ff3ec 100644 --- a/meson.build +++ b/meson.build @@ -77,15 +77,16 @@ updatedb_conf_man = configure_file(input: 'updatedb.conf.5.in', install_man(updatedb_conf_man) if get_option('install_systemd') - systemd = dependency('systemd', required: false) - if systemd.found() - unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir') - updatedb_service = configure_file(input: 'plocate-updatedb.service.in', - output: 'plocate-updatedb.service', - configuration: conf_data) - install_data(updatedb_service, install_dir: unitdir) - install_data('plocate-updatedb.timer', install_dir: unitdir) + unitdir = get_option('systemunitdir') + if unitdir == '' + unitdir = dependency('systemd').get_pkgconfig_variable('systemdsystemunitdir') endif + + updatedb_service = configure_file(input: 'plocate-updatedb.service.in', + output: 'plocate-updatedb.service', + configuration: conf_data) + install_data(updatedb_service, install_dir: unitdir) + install_data('plocate-updatedb.timer', install_dir: unitdir) endif # Requires having TurboPFor checked out, so not built by default. diff --git a/meson_options.txt b/meson_options.txt index 7d33262..8ac13c5 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,5 @@ option('install_cron', type: 'boolean', value: false, description: 'Install mlocate conversion script into /etc/cron.daily') option('install_systemd', type: 'boolean', value: true, description: 'Install systemd service and timer for updatedb, if systemd is installed') +option('systemunitdir', type: 'string', description: 'Where to install systemd units to (default: autodetect)') option('locategroup', type: 'string', value: 'plocate', description: 'Group that the install script will use for the .db file') option('updatedb_progname', type: 'string', value: 'updatedb', description: 'Binary name of updatedb') -- 2.39.2