diff --git a/data/fbd-alert-slider.service.in b/data/fbd-alert-slider.service.in new file mode 100644 index 0000000..75bbf23 --- /dev/null +++ b/data/fbd-alert-slider.service.in @@ -0,0 +1,11 @@ +[Unit] +Description=Feedbackd Alert Slider Handler +PartOf=graphical-session.target + +[Service] +ExecStart=@libexecdir@/fbd-alert-slider +Restart=on-abnormal +RestartSec=10s + +[Install] +WantedBy=graphical-session.target diff --git a/data/meson.build b/data/meson.build index f9b78e6..7ff25cc 100644 --- a/data/meson.build +++ b/data/meson.build @@ -72,4 +72,24 @@ if get_option('udev') install_data('90-feedbackd.rules', install_dir: udevdir) endif +systemd_user_unit_dir = get_option('systemd_user_unit_dir') +systemd_dep = dependency('systemd', required: false) +if systemd_user_unit_dir == '' + if systemd_dep.found() + systemd_user_unit_dir = systemd_dep.get_variable('systemd_user_unit_dir') + else + systemd_user_unit_dir = prefix / libdir / 'systemd' / 'user' + endif +endif + +# Alert slider Systemd user service +alert_slider_unit = 'fbd-alert-slider.service' +configure_file( + input : alert_slider_unit + '.in', + output : alert_slider_unit, + configuration : service_data, + install : true, + install_dir : systemd_user_unit_dir, +) + endif # daemon diff --git a/debian/feedbackd.install b/debian/feedbackd.install index fcfbd17..b963012 100644 --- a/debian/feedbackd.install +++ b/debian/feedbackd.install @@ -1,4 +1,5 @@ usr/bin/ +usr/lib/systemd/user usr/lib/udev/ usr/libexec/ usr/share/dbus-1/ diff --git a/meson.build b/meson.build index 1515920..6e8f301 100644 --- a/meson.build +++ b/meson.build @@ -27,6 +27,7 @@ if get_option('daemon') gsound = dependency('gsound') gudev = dependency('gudev-1.0', version: '>=232') json_glib = dependency('json-glib-1.0') + systemd_dep = dependency('systemd', required: false) endif prefix = get_option('prefix') diff --git a/meson_options.txt b/meson_options.txt index 33a5071..9db4de7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -16,3 +16,6 @@ option('man', option('tests', type: 'boolean', value: true, description: 'Whether to compile unit tests') +option('systemd_user_unit_dir', + type: 'string', value: '', + description: 'Directory for systemd user units')