From 588e3aa0debc0f78423dd3eedc3aac50c77ce901 Mon Sep 17 00:00:00 2001 From: Alexander Epaneshnikov Date: Mon, 25 Jan 2021 23:32:21 +0300 Subject: [PATCH] add systemd unit install logic --- meson.build | 1 + services/meson.build | 4 ++++ .../{espeakup.service => espeakup.service.in} | 6 ++--- services/systemd/meson.build | 23 +++++++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 services/meson.build rename services/systemd/{espeakup.service => espeakup.service.in} (66%) create mode 100644 services/systemd/meson.build diff --git a/meson.build b/meson.build index 91bbd9c..87513da 100644 --- a/meson.build +++ b/meson.build @@ -11,6 +11,7 @@ m_dep = cc.find_library('m', required : false) subdir('src') subdir('doc') +subdir('services') executable('espeakup', espeakup_sources, diff --git a/services/meson.build b/services/meson.build new file mode 100644 index 0000000..14bee50 --- /dev/null +++ b/services/meson.build @@ -0,0 +1,4 @@ +systemd = dependency('systemd', required: false) +if systemd.found() + subdir('systemd') +endif diff --git a/services/systemd/espeakup.service b/services/systemd/espeakup.service.in similarity index 66% rename from services/systemd/espeakup.service rename to services/systemd/espeakup.service.in index b840489..bf58905 100644 --- a/services/systemd/espeakup.service +++ b/services/systemd/espeakup.service.in @@ -6,10 +6,10 @@ After=systemd-udev-settle.service sound.target [Service] Type=forking -EnvironmentFile=/etc/conf.d/espeakup +EnvironmentFile=@sysconfdir@/conf.d/espeakup.conf PIDFile=/run/espeakup.pid -ExecStartPre=+/sbin/modprobe speakup_soft -ExecStart=/usr/bin/espeakup --default-voice=${default_voice} +ExecStartPre=+modprobe speakup_soft +ExecStart=@bindir@/espeakup --default-voice=${default_voice} ExecReload=kill -HUP $MAINPID Restart=always diff --git a/services/systemd/meson.build b/services/systemd/meson.build new file mode 100644 index 0000000..7e4f07e --- /dev/null +++ b/services/systemd/meson.build @@ -0,0 +1,23 @@ +unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir') +prefixdir = get_option('prefix') +bindir = join_paths(prefixdir, get_option('bindir')) +sysconfdir = join_paths(prefixdir, get_option('sysconfdir')) + +unit_conf = configuration_data() + +unit_conf.set('bindir', bindir) +unit_conf.set('sysconfdir', sysconfdir) + +service_file = configure_file( + input : 'espeakup.service.in', + output : 'espeakup.service', + configuration : unit_conf +) + +install_data(service_file, + install_dir : unitdir +) + +install_data('espeakup.conf', + install_dir : join_paths(sysconfdir, 'conf.d') +)