From: Steinar H. Gunderson Date: Mon, 21 Jun 2021 19:21:53 +0000 (+0200) Subject: Make it possible to set systemunitdir explicitly. X-Git-Tag: 1.1.9~4 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=d8b761f706a9f3d317f90fddfba7537fd81deedf;hp=938b7cb0199dba982e94c50d803a467e3d219649;p=plocate Make it possible to set systemunitdir explicitly. 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. --- 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')