Commit 327f1eee authored by Iñigo Martínez's avatar Iñigo Martínez

build: Make SystemdService entry conditional

When systemd user units installation is disabled, SystemdService
entry should also not be present on D-Bus service files.

This patch adds a common D-Bus service file template allowing,
an homogeneus D-Bus service file generation and also a
SystemService entry conditioned to the systemd user units
installation option.

https://bugzilla.gnome.org/show_bug.cgi?id=786149
parent d1189c1b
subdir('trashlib')
# D-Bus and systemd service files
service = gvfs_namespace + '.Daemon.service'
daemon_service = configure_file(
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
dbus_service = gvfs_namespace + '.Daemon'
dbus_exec = 'gvfsd'
dbus_systemd_service = ''
if install_systemd_user_unit_dir
service = 'gvfs-daemon.service'
......@@ -21,8 +15,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir,
configuration: service_conf
)
dbus_systemd_service = 'SystemdService=' + service
endif
dbus_service_conf = configuration_data()
dbus_service_conf.set('service', dbus_service)
dbus_service_conf.set('exec', join_paths(gvfs_libexecdir, dbus_exec))
dbus_service_conf.set('systemd_service', dbus_systemd_service)
daemon_service = configure_file(
input: dbus_service_in,
output: dbus_service + '.service',
install: true,
install_dir: dbus_service_dir,
configuration: dbus_service_conf
)
gnome.mkenums(
'org.gnome.system.gvfs.enums.xml',
sources: 'gvfs-enums.h',
......
[D-BUS Service]
Name=@service@
Exec=@exec@
@systemd_service@
......@@ -277,6 +277,8 @@ if dbus_service_dir == ''
dbus_service_dir = dbus_dep.get_pkgconfig_variable('session_bus_services_dir')
endif
dbus_service_in = files('dbus.service.in')
gio_module_dir = get_option('with-gio-module-dir')
if gio_module_dir == ''
gio_module_dir = gio_dep.get_pkgconfig_variable('giomoduledir')
......
service = gvfs_namespace + '.Metadata.service'
metadata_service = configure_file(
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
dbus_service = gvfs_namespace + '.Metadata'
dbus_exec = 'gvfsd-metadata'
dbus_systemd_service = ''
if install_systemd_user_unit_dir
service = 'gvfs-metadata.service'
......@@ -18,8 +12,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir,
configuration: service_conf
)
dbus_systemd_service = 'SystemdService=' + service
endif
dbus_service_conf = configuration_data()
dbus_service_conf.set('service', dbus_service)
dbus_service_conf.set('exec', join_paths(gvfs_libexecdir, dbus_exec))
dbus_service_conf.set('systemd_service', dbus_systemd_service)
metadata_service = configure_file(
input: dbus_service_in,
output: dbus_service + '.service',
install: true,
install_dir: dbus_service_dir,
configuration: dbus_service_conf
)
metadata_dbus = gnome.gdbus_codegen(
'metadata-dbus',
'dbus-interface.xml',
......
......@@ -5,18 +5,12 @@ install_data(
install_dir: gvfs_remote_volume_monitors_dir
)
service = gvfs_namespace + '.AfcVolumeMonitor.service'
afc_service = configure_file(
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
dbus_service = gvfs_namespace + '.AfcVolumeMonitor'
dbus_exec = 'gvfs-afc-volume-monitor'
dbus_systemd_service = ''
if install_systemd_user_unit_dir
service = 'gvfs-afc-volume-monitor.service'
service = dbus_exec + '.service'
configure_file(
input: service + '.in',
......@@ -25,8 +19,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir,
configuration: service_conf
)
dbus_systemd_service = 'SystemdService=' + service
endif
dbus_service_conf = configuration_data()
dbus_service_conf.set('service', dbus_service)
dbus_service_conf.set('exec', join_paths(gvfs_libexecdir, dbus_exec))
dbus_service_conf.set('systemd_service', dbus_systemd_service)
afc_service = configure_file(
input: dbus_service_in,
output: dbus_service + '.service',
install: true,
install_dir: dbus_service_dir,
configuration: dbus_service_conf
)
sources = files(
'afcvolumemonitordaemon.c',
'afcvolume.c',
......
......@@ -5,18 +5,12 @@ install_data(
install_dir: gvfs_remote_volume_monitors_dir
)
service = gvfs_namespace + '.GduVolumeMonitor.service'
gdu_service = configure_file(
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
dbus_service = gvfs_namespace + '.GduVolumeMonitor'
dbus_exec = 'gvfs-gdu-volume-monitor'
dbus_systemd_service = ''
if install_systemd_user_unit_dir
service = 'gvfs-gdu-volume-monitor.service'
service = dbus_exec + '.service'
configure_file(
input: service + '.in',
......@@ -25,8 +19,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir,
configuration: service_conf
)
dbus_systemd_service = 'SystemdService=' + service
endif
dbus_service_conf = configuration_data()
dbus_service_conf.set('service', dbus_service)
dbus_service_conf.set('exec', join_paths(gvfs_libexecdir, dbus_exec))
dbus_service_conf.set('systemd_service', dbus_systemd_service)
gdu_service = configure_file(
input: dbus_service_in,
output: dbus_service + '.service',
install: true,
install_dir: dbus_service_dir,
configuration: dbus_service_conf
)
sources = files(
'gdu-volume-monitor-daemon.c',
'ggdudrive.c',
......
......@@ -3,18 +3,12 @@ install_data(
install_dir: gvfs_remote_volume_monitors_dir
)
service = gvfs_namespace + '.GoaVolumeMonitor.service'
configure_file(
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
dbus_service = gvfs_namespace + '.GoaVolumeMonitor'
dbus_exec = 'gvfs-goa-volume-monitor'
dbus_systemd_service = ''
if install_systemd_user_unit_dir
service = 'gvfs-goa-volume-monitor.service'
service = dbus_exec + '.service'
configure_file(
input: service + '.in',
......@@ -23,8 +17,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir,
configuration: service_conf
)
dbus_systemd_service = 'SystemdService=' + service
endif
dbus_service_conf = configuration_data()
dbus_service_conf.set('service', dbus_service)
dbus_service_conf.set('exec', join_paths(gvfs_libexecdir, dbus_exec))
dbus_service_conf.set('systemd_service', dbus_systemd_service)
configure_file(
input: dbus_service_in,
output: dbus_service + '.service',
install: true,
install_dir: dbus_service_dir,
configuration: dbus_service_conf
)
sources = files(
'goavolumemonitordaemon.c',
'goavolume.c',
......
......@@ -5,18 +5,13 @@ install_data(
install_dir: gvfs_remote_volume_monitors_dir
)
service = gvfs_namespace + '.GPhoto2VolumeMonitor.service'
gphoto2_service = configure_file(
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
dbus_service = gvfs_namespace + '.GPhoto2VolumeMonitor'
dbus_exec = 'gvfs-gphoto2-volume-monitor'
dbus_systemd_service = ''
if install_systemd_user_unit_dir
service = 'gvfs-gphoto2-volume-monitor.service'
service = dbus_exec + '.service'
configure_file(
input: service + '.in',
......@@ -25,8 +20,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir,
configuration: service_conf
)
dbus_systemd_service = 'SystemdService=' + service
endif
dbus_service_conf = configuration_data()
dbus_service_conf.set('service', dbus_service)
dbus_service_conf.set('exec', join_paths(gvfs_libexecdir, dbus_exec))
dbus_service_conf.set('systemd_service', dbus_systemd_service)
gphoto2_service = configure_file(
input: dbus_service_in,
output: dbus_service + '.service',
install: true,
install_dir: dbus_service_dir,
configuration: dbus_service_conf
)
sources = files(
'gphoto2-volume-monitor-daemon.c',
'ggphoto2volume.c',
......
......@@ -3,18 +3,12 @@ install_data(
install_dir: gvfs_remote_volume_monitors_dir
)
service = gvfs_namespace + '.MTPVolumeMonitor.service'
configure_file(
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
dbus_service = gvfs_namespace + '.MTPVolumeMonitor'
dbus_exec = 'gvfs-mtp-volume-monitor'
dbus_systemd_service = ''
if install_systemd_user_unit_dir
service = 'gvfs-mtp-volume-monitor.service'
service = dbus_exec + '.service'
configure_file(
input: service + '.in',
......@@ -23,8 +17,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir,
configuration: service_conf
)
dbus_systemd_service = 'SystemdService=' + service
endif
dbus_service_conf = configuration_data()
dbus_service_conf.set('service', dbus_service)
dbus_service_conf.set('exec', join_paths(gvfs_libexecdir, dbus_exec))
dbus_service_conf.set('systemd_service', dbus_systemd_service)
configure_file(
input: dbus_service_in,
output: dbus_service + '.service',
install: true,
install_dir: dbus_service_dir,
configuration: dbus_service_conf
)
sources = files(
'mtp-volume-monitor-daemon.c',
'gmtpvolume.c',
......
......@@ -5,18 +5,12 @@ install_data(
install_dir: gvfs_remote_volume_monitors_dir
)
service = gvfs_namespace + '.UDisks2VolumeMonitor.service'
udisks2_service = configure_file(
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
dbus_service = gvfs_namespace + '.UDisks2VolumeMonitor'
dbus_exec = 'gvfs-udisks2-volume-monitor'
dbus_systemd_service = ''
if install_systemd_user_unit_dir
service = 'gvfs-udisks2-volume-monitor.service'
service = dbus_exec + '.service'
configure_file(
input: service + '.in',
......@@ -25,8 +19,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir,
configuration: service_conf
)
dbus_systemd_service = 'SystemdService=' + service
endif
dbus_service_conf = configuration_data()
dbus_service_conf.set('service', dbus_service)
dbus_service_conf.set('exec', join_paths(gvfs_libexecdir, dbus_exec))
dbus_service_conf.set('systemd_service', dbus_systemd_service)
udisks2_service = configure_file(
input: dbus_service_in,
output: dbus_service + '.service',
install: true,
install_dir: dbus_service_dir,
configuration: dbus_service_conf
)
sources = files(
'udisks2volumemonitordaemon.c',
'gvfsudisks2drive.c',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment