diff options
author | Benjamin Berg <bberg@redhat.com> | 2019-04-20 00:39:15 +0200 |
---|---|---|
committer | Benjamin Berg <benjamin@sipsolutions.net> | 2019-08-05 21:47:38 +0000 |
commit | 50eccb08910419ca8a0f085bd547b38203ab4492 (patch) | |
tree | 420c60931127d985a2c59404f788d726a80f95fa /plugins/meson.build | |
parent | 65253003cd54b066e1d0c8c89a4b7ee6225555f1 (diff) | |
download | gnome-settings-daemon-50eccb08910419ca8a0f085bd547b38203ab4492.tar.gz |
plugins: Add systemd user service files for all the plugins
Using the facility added in the previous commit, we can add systemd user
service files for all plugins and know when they have started up.
This is roughly based on the work previously done by Iain Lane
<iain@orangesquash.org.uk> and Bastien Nocera hadess@hadess.net>.
For each g-s-d process we have a service and a target file. This
separation only exists to contain dependency failures which would cause
an OnFailure action to trigger and is needed so that we can use
OnFailure for the gnome-session fail-whale
(gnome-session-failed.target).
In general, the approach taken is that we start g-s-d processes after
gnome-session-initialized.target and before gnome-session.target.
We want to be able to selectively start the services only when one or
more dependencies are there, or even mask out services under some
conditions. The approach taken is the following:
* To mask a service, use a Conflicts entry. This is e.g. used to not
start certain services in GDM using
Conflicts=gnome-session@gnome-login.target
* To depend on multiple targets to be up and running to start, we set
each of these targets in Requisite/After/PartOf/WantedBy. We always
do this for gnome-session-initialized.target but this method is
extensible to any number of further targets (e.g. bluetooth.target)
Diffstat (limited to 'plugins/meson.build')
-rw-r--r-- | plugins/meson.build | 68 |
1 files changed, 62 insertions, 6 deletions
diff --git a/plugins/meson.build b/plugins/meson.build index a8a39e40..547e8bdb 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -1,6 +1,6 @@ enabled_plugins = [ - ['a11y-settings', 'A11ySettings'], - ['color', 'Color'], + ['a11y-settings', 'A11ySettings', ''], + ['color', 'Color', ''], ['datetime', 'Datetime'], ['dummy', ''], ['power', 'Power'], @@ -18,7 +18,7 @@ if enable_smartcard endif if enable_wacom - enabled_plugins += [['wacom', 'Wacom']] + enabled_plugins += [['wacom', 'Wacom', 'wacom.target.wants/']] endif if enable_cups @@ -33,33 +33,89 @@ if enable_wwan enabled_plugins += [['wwan', 'Wwan']] endif +plugin_install_extra_wants = { +# 'dummy': ['required-started.target.wants/'], +# 'xsettings': ['gnome-session-x11.target.wants/'], +# 'wacom': ['wacom.target.wants/'], +# 'smartcard': ['smartcard.target.wants/'], +} + plugins_conf = configuration_data() plugins_conf.set('libexecdir', gsd_libexecdir) +plugins_conf.set('systemd_hidden', enable_systemd ? 'true' : 'false') plugins_deps = [libgsd_dep] plugins_cflags = ['-DGNOME_SETTINGS_LOCALEDIR="@0@"'.format(gsd_localedir)] +enabled_plugins_file = [] + foreach plugin: [['common', '']] + enabled_plugins plugin_name = plugin[0] - plugin_dbus_name = plugin[1] + desktop = 'org.gnome.SettingsDaemon.@0@.desktop'.format(plugin[1]) + + if plugin[1] == '' # common or dummy + desktop_in_file = '' + else + desktop_in_file = files(join_paths(plugin_name, desktop + '.in')) + endif + + enabled_plugins_file += [[plugin_name, plugin[1], desktop_in_file]] +endforeach + +foreach plugin: enabled_plugins_file + plugin_name = plugin[0] + plugin_name_case = plugin[1] + plugin_dbus_name='org.gnome.SettingsDaemon.@0@'.format(plugin_name_case) cflags = [ '-DG_LOG_DOMAIN="@0@-plugin"'.format(plugin_name), '-DPLUGIN_NAME="@0@"'.format(plugin_name), - '-DPLUGIN_DBUS_NAME="org.gnome.SettingsDaemon.@0@"'.format(plugin_dbus_name), + '-DPLUGIN_DBUS_NAME="@0@"'.format(plugin_dbus_name), ] + plugins_cflags if not ['common', 'dummy'].contains(plugin_name) desktop = 'org.gnome.SettingsDaemon.@0@.desktop'.format(plugin[1]) + desktop_in_file = plugin[2] + user_target = 'gsd-@0@.target'.format(plugin_name) + user_service = 'gsd-@0@.service'.format(plugin_name) + + unit_conf = configuration_data() + unit_conf.set('libexecdir', gsd_libexecdir) + unit_conf.set('plugin_dbus_name', plugin_dbus_name) configure_file( - input: join_paths(plugin_name, desktop + '.in'), + input: desktop_in_file, output: desktop, configuration: plugins_conf, install: true, install_dir: gsd_xdg_autostart ) + if enable_systemd + configure_file( + input: join_paths(plugin_name, user_service + '.in'), + output: user_service, + configuration: unit_conf, + install: true, + install_dir: systemd_userunitdir + ) + configure_file( + input: join_paths(plugin_name, user_target + '.in'), + output: user_target, + configuration: unit_conf, + install: true, + install_dir: systemd_userunitdir + ) + + wants = ['gnome-session-initialized.target.wants/'] + if plugin_name in plugin_install_extra_wants + wants += [plugin_install_extra_wants[plugin_name]] + endif + + foreach target: wants + meson.add_install_script('meson-add-wants.sh', systemd_userunitdir, target, user_target) + endforeach + endif endif subdir(plugin_name) |