summaryrefslogtreecommitdiff
path: root/plugins/meson.build
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2019-12-13 16:24:19 +0100
committerBenjamin Berg <benjamin@sipsolutions.net>2020-07-31 08:53:12 +0000
commit3acdc124699cfc186fbe15e828db2c23f43b6591 (patch)
tree51acb15970fff6b2fb3683f41133f63fd75438ec /plugins/meson.build
parent9108152de8227a1a2d3df3444046e18df6fcd041 (diff)
downloadgnome-settings-daemon-3acdc124699cfc186fbe15e828db2c23f43b6591.tar.gz
plugins: Update systemd unit design and generate them
Rather than having per-plugin units, generate them from the meson build file using a common template. The unit layout is changed somewhat. The .target file now is solely a flag on whether the service is requested for the session type. The variosu requirements are all moved into the .service file. Instead of using an OnFailure and trying to contain the dependency errors in a separate unit, we now use ExecStopPost. It seems that the current approach has never worked anyway. The Conflict entries on certain session types are gone now. This is instead handled outside of gnome-settings-daemon.
Diffstat (limited to 'plugins/meson.build')
-rw-r--r--plugins/meson.build57
1 files changed, 46 insertions, 11 deletions
diff --git a/plugins/meson.build b/plugins/meson.build
index 885d3ffa..99f1e7b3 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -40,11 +40,16 @@ if not enable_wwan
disabled_plugins += ['wwan']
endif
+# Specify futher required units, 'before' or 'after' may be specified if ordering is needed
plugin_gate_units = {
- 'xsettings': ['gnome-session-x11-services.target'],
-# 'dummy': ['required-started.target.wants/'],
-# 'wacom': ['wacom.target.wants/'],
-# 'smartcard': ['smartcard.target.wants/'],
+ 'xsettings': [['gnome-session-x11-services.target', 'before']],
+# 'wacom': [['wacom.target']],
+# 'smartcard': [['smartcard.target']],
+}
+
+# Restart=on-failure is the default
+plugin_restart_rule = {
+ 'xsettings' : 'on-abnormal',
}
plugins_conf = configuration_data()
@@ -101,30 +106,60 @@ foreach plugin: all_plugins
user_service = 'gsd-@0@.service'.format(plugin_name)
unit_conf = configuration_data()
+ unit_conf.set('plugin_name', plugin_name)
+ unit_conf.set('description', plugin_description)
unit_conf.set('libexecdir', gsd_libexecdir)
unit_conf.set('plugin_dbus_name', plugin_dbus_name)
+ unit_conf.set('plugin_restart', plugin_restart_rule.get(plugin_name, 'on-failure'))
+
+ gates_all = []
+ gates_after = []
+ gates_before = []
+ foreach gate: plugin_gate_units.get(plugin_name, [])
+ gates_all += [gate[0]]
+ if gate.length() > 1
+ if gate[1] == 'before'
+ gates_before += [gate[0]]
+ elif gate[1] == 'after'
+ gates_after += [gate[0]]
+ else
+ error('Ordering key must be either "before" or "after"')
+ endif
+ endif
+ endforeach
+ gate_unit_section = []
+ if gates_all.length() > 0
+ gate_unit_section += ['Requisite=' + ' '.join(gates_all)]
+ gate_unit_section += ['PartOf=' + ' '.join(gates_all)]
+
+ if gates_after.length() > 0
+ gate_unit_section += ['After=' + ' '.join(gates_after)]
+ endif
+ if gates_before.length() > 0
+ gate_unit_section += ['Before=' + ' '.join(gates_before)]
+ endif
+ endif
+ unit_conf.set('plugin_gate_units_section', '\n'.join(gate_unit_section))
if enable_systemd
configure_file(
- input: join_paths(plugin_name, user_service + '.in'),
+ input: 'gsd.service.in',
output: user_service,
configuration: unit_conf,
install: true,
install_dir: systemd_userunitdir
)
configure_file(
- input: join_paths(plugin_name, user_target + '.in'),
+ input: 'gsd.target.in',
output: user_target,
configuration: unit_conf,
install: true,
install_dir: systemd_userunitdir
)
- if plugin_name in plugin_gate_units
- foreach target: plugin_gate_units[plugin_name]
- meson.add_install_script('meson-add-wants.sh', systemd_userunitdir, target, user_target)
- endforeach
- endif
+ foreach target: gates_all
+ meson.add_install_script('meson-add-wants.sh', systemd_userunitdir, target + '.wants/', user_service)
+ endforeach
endif
subdir(plugin_name)