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') subdir('trashlib')
# D-Bus and systemd service files # D-Bus and systemd service files
service = gvfs_namespace + '.Daemon.service' dbus_service = gvfs_namespace + '.Daemon'
dbus_exec = 'gvfsd'
daemon_service = configure_file( dbus_systemd_service = ''
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
if install_systemd_user_unit_dir if install_systemd_user_unit_dir
service = 'gvfs-daemon.service' service = 'gvfs-daemon.service'
...@@ -21,8 +15,23 @@ if install_systemd_user_unit_dir ...@@ -21,8 +15,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir, install_dir: systemd_user_unit_dir,
configuration: service_conf configuration: service_conf
) )
dbus_systemd_service = 'SystemdService=' + service
endif 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( gnome.mkenums(
'org.gnome.system.gvfs.enums.xml', 'org.gnome.system.gvfs.enums.xml',
sources: 'gvfs-enums.h', sources: 'gvfs-enums.h',
......
[D-BUS Service]
Name=@service@
Exec=@exec@
@systemd_service@
...@@ -277,6 +277,8 @@ if dbus_service_dir == '' ...@@ -277,6 +277,8 @@ if dbus_service_dir == ''
dbus_service_dir = dbus_dep.get_pkgconfig_variable('session_bus_services_dir') dbus_service_dir = dbus_dep.get_pkgconfig_variable('session_bus_services_dir')
endif endif
dbus_service_in = files('dbus.service.in')
gio_module_dir = get_option('with-gio-module-dir') gio_module_dir = get_option('with-gio-module-dir')
if gio_module_dir == '' if gio_module_dir == ''
gio_module_dir = gio_dep.get_pkgconfig_variable('giomoduledir') gio_module_dir = gio_dep.get_pkgconfig_variable('giomoduledir')
......
service = gvfs_namespace + '.Metadata.service' dbus_service = gvfs_namespace + '.Metadata'
dbus_exec = 'gvfsd-metadata'
metadata_service = configure_file( dbus_systemd_service = ''
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
if install_systemd_user_unit_dir if install_systemd_user_unit_dir
service = 'gvfs-metadata.service' service = 'gvfs-metadata.service'
...@@ -18,8 +12,23 @@ if install_systemd_user_unit_dir ...@@ -18,8 +12,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir, install_dir: systemd_user_unit_dir,
configuration: service_conf configuration: service_conf
) )
dbus_systemd_service = 'SystemdService=' + service
endif 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 = gnome.gdbus_codegen(
'metadata-dbus', 'metadata-dbus',
'dbus-interface.xml', 'dbus-interface.xml',
......
...@@ -5,18 +5,12 @@ install_data( ...@@ -5,18 +5,12 @@ install_data(
install_dir: gvfs_remote_volume_monitors_dir install_dir: gvfs_remote_volume_monitors_dir
) )
service = gvfs_namespace + '.AfcVolumeMonitor.service' dbus_service = gvfs_namespace + '.AfcVolumeMonitor'
dbus_exec = 'gvfs-afc-volume-monitor'
afc_service = configure_file( dbus_systemd_service = ''
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
if install_systemd_user_unit_dir if install_systemd_user_unit_dir
service = 'gvfs-afc-volume-monitor.service' service = dbus_exec + '.service'
configure_file( configure_file(
input: service + '.in', input: service + '.in',
...@@ -25,8 +19,23 @@ if install_systemd_user_unit_dir ...@@ -25,8 +19,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir, install_dir: systemd_user_unit_dir,
configuration: service_conf configuration: service_conf
) )
dbus_systemd_service = 'SystemdService=' + service
endif 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( sources = files(
'afcvolumemonitordaemon.c', 'afcvolumemonitordaemon.c',
'afcvolume.c', 'afcvolume.c',
......
...@@ -5,18 +5,12 @@ install_data( ...@@ -5,18 +5,12 @@ install_data(
install_dir: gvfs_remote_volume_monitors_dir install_dir: gvfs_remote_volume_monitors_dir
) )
service = gvfs_namespace + '.GduVolumeMonitor.service' dbus_service = gvfs_namespace + '.GduVolumeMonitor'
dbus_exec = 'gvfs-gdu-volume-monitor'
gdu_service = configure_file( dbus_systemd_service = ''
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
if install_systemd_user_unit_dir if install_systemd_user_unit_dir
service = 'gvfs-gdu-volume-monitor.service' service = dbus_exec + '.service'
configure_file( configure_file(
input: service + '.in', input: service + '.in',
...@@ -25,8 +19,23 @@ if install_systemd_user_unit_dir ...@@ -25,8 +19,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir, install_dir: systemd_user_unit_dir,
configuration: service_conf configuration: service_conf
) )
dbus_systemd_service = 'SystemdService=' + service
endif 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( sources = files(
'gdu-volume-monitor-daemon.c', 'gdu-volume-monitor-daemon.c',
'ggdudrive.c', 'ggdudrive.c',
......
...@@ -3,18 +3,12 @@ install_data( ...@@ -3,18 +3,12 @@ install_data(
install_dir: gvfs_remote_volume_monitors_dir install_dir: gvfs_remote_volume_monitors_dir
) )
service = gvfs_namespace + '.GoaVolumeMonitor.service' dbus_service = gvfs_namespace + '.GoaVolumeMonitor'
dbus_exec = 'gvfs-goa-volume-monitor'
configure_file( dbus_systemd_service = ''
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
if install_systemd_user_unit_dir if install_systemd_user_unit_dir
service = 'gvfs-goa-volume-monitor.service' service = dbus_exec + '.service'
configure_file( configure_file(
input: service + '.in', input: service + '.in',
...@@ -23,8 +17,23 @@ if install_systemd_user_unit_dir ...@@ -23,8 +17,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir, install_dir: systemd_user_unit_dir,
configuration: service_conf configuration: service_conf
) )
dbus_systemd_service = 'SystemdService=' + service
endif 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( sources = files(
'goavolumemonitordaemon.c', 'goavolumemonitordaemon.c',
'goavolume.c', 'goavolume.c',
......
...@@ -5,18 +5,13 @@ install_data( ...@@ -5,18 +5,13 @@ install_data(
install_dir: gvfs_remote_volume_monitors_dir install_dir: gvfs_remote_volume_monitors_dir
) )
service = gvfs_namespace + '.GPhoto2VolumeMonitor.service'
gphoto2_service = configure_file( dbus_service = gvfs_namespace + '.GPhoto2VolumeMonitor'
input: service + '.in', dbus_exec = 'gvfs-gphoto2-volume-monitor'
output: service, dbus_systemd_service = ''
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
if install_systemd_user_unit_dir if install_systemd_user_unit_dir
service = 'gvfs-gphoto2-volume-monitor.service' service = dbus_exec + '.service'
configure_file( configure_file(
input: service + '.in', input: service + '.in',
...@@ -25,8 +20,23 @@ if install_systemd_user_unit_dir ...@@ -25,8 +20,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir, install_dir: systemd_user_unit_dir,
configuration: service_conf configuration: service_conf
) )
dbus_systemd_service = 'SystemdService=' + service
endif 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( sources = files(
'gphoto2-volume-monitor-daemon.c', 'gphoto2-volume-monitor-daemon.c',
'ggphoto2volume.c', 'ggphoto2volume.c',
......
...@@ -3,18 +3,12 @@ install_data( ...@@ -3,18 +3,12 @@ install_data(
install_dir: gvfs_remote_volume_monitors_dir install_dir: gvfs_remote_volume_monitors_dir
) )
service = gvfs_namespace + '.MTPVolumeMonitor.service' dbus_service = gvfs_namespace + '.MTPVolumeMonitor'
dbus_exec = 'gvfs-mtp-volume-monitor'
configure_file( dbus_systemd_service = ''
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
if install_systemd_user_unit_dir if install_systemd_user_unit_dir
service = 'gvfs-mtp-volume-monitor.service' service = dbus_exec + '.service'
configure_file( configure_file(
input: service + '.in', input: service + '.in',
...@@ -23,8 +17,23 @@ if install_systemd_user_unit_dir ...@@ -23,8 +17,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir, install_dir: systemd_user_unit_dir,
configuration: service_conf configuration: service_conf
) )
dbus_systemd_service = 'SystemdService=' + service
endif 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( sources = files(
'mtp-volume-monitor-daemon.c', 'mtp-volume-monitor-daemon.c',
'gmtpvolume.c', 'gmtpvolume.c',
......
...@@ -5,18 +5,12 @@ install_data( ...@@ -5,18 +5,12 @@ install_data(
install_dir: gvfs_remote_volume_monitors_dir install_dir: gvfs_remote_volume_monitors_dir
) )
service = gvfs_namespace + '.UDisks2VolumeMonitor.service' dbus_service = gvfs_namespace + '.UDisks2VolumeMonitor'
dbus_exec = 'gvfs-udisks2-volume-monitor'
udisks2_service = configure_file( dbus_systemd_service = ''
input: service + '.in',
output: service,
install: true,
install_dir: dbus_service_dir,
configuration: service_conf
)
if install_systemd_user_unit_dir if install_systemd_user_unit_dir
service = 'gvfs-udisks2-volume-monitor.service' service = dbus_exec + '.service'
configure_file( configure_file(
input: service + '.in', input: service + '.in',
...@@ -25,8 +19,23 @@ if install_systemd_user_unit_dir ...@@ -25,8 +19,23 @@ if install_systemd_user_unit_dir
install_dir: systemd_user_unit_dir, install_dir: systemd_user_unit_dir,
configuration: service_conf configuration: service_conf
) )
dbus_systemd_service = 'SystemdService=' + service
endif 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( sources = files(
'udisks2volumemonitordaemon.c', 'udisks2volumemonitordaemon.c',
'gvfsudisks2drive.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