~kennylevinsen/public-inbox

poweralertd: Introduce systemd user unit file v1 APPLIED

Antoine Damhet
Antoine Damhet: 1
 Introduce systemd user unit file

 2 files changed, 24 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~kennylevinsen/public-inbox/patches/10731/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH poweralertd] Introduce systemd user unit file Export this patch

Antoine Damhet
The unit will be installed if `poweralertd` is built with `logind`.

Signed-off-by: Antoine Damhet <antoine.damhet@lse.epita.fr>
---

I needed to re-craft the default install path of binaries, that should
be consistent with `meson`'s one.

 contrib/systemd-user/poweralertd.service.in | 12 ++++++++++++
 meson.build                                 | 12 ++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 contrib/systemd-user/poweralertd.service.in

diff --git a/contrib/systemd-user/poweralertd.service.in b/contrib/systemd-user/poweralertd.service.in
new file mode 100644
index 0000000..475fa00
--- /dev/null
+++ b/contrib/systemd-user/poweralertd.service.in
@@ -0,0 +1,12 @@
[Unit]
Description=UPower-powered power alerter
Documentation=man:poweralertd(1)
PartOf=graphical-session.target
Requires=graphical-session.target

[Service]
Type=simple
ExecStart=@bindir@/poweralertd

[Install]
WantedBy=graphical-session.target
diff --git a/meson.build b/meson.build
index 9ef0ad6..ae5e27e 100644
--- a/meson.build
+++ b/meson.build
@@ -13,9 +13,21 @@ project(
add_project_arguments('-Wno-unused-parameter', language: 'c')
add_project_arguments('-Wno-missing-braces', language: 'c')

configuration = configuration_data()
configuration.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))

logind = dependency('libsystemd', required: false)
if logind.found()
	add_project_arguments('-DHAVE_SYSTEMD=1', language: 'c')

	systemd = dependency('systemd', required: true)
	systemd_units_dir = systemd.get_pkgconfig_variable('systemduserunitdir')
	configure_file(
		configuration: configuration,
		input: 'contrib/systemd-user/poweralertd.service.in',
		output: '@BASENAME@',
		install_dir: systemd_units_dir
	)
else
	logind = dependency('libelogind')
	add_project_arguments('-DHAVE_ELOGIND=1', language: 'c')
-- 
2.26.2

May 21, 2020 10:14 AM, "Antoine Damhet" <antoine.damhet@lse.epita.fr> wrote: