add pid file to systemd unit and move services to data folder
This commit is contained in:
@@ -26,3 +26,7 @@ subdir('ui')
|
||||
subdir('icons')
|
||||
subdir('gschema')
|
||||
subdir('man')
|
||||
subdir('openrc')
|
||||
subdir('runit')
|
||||
subdir('s6')
|
||||
subdir('systemd')
|
||||
|
18
data/openrc/meson.build
Normal file
18
data/openrc/meson.build
Normal file
@@ -0,0 +1,18 @@
|
||||
openrc_config_data = configuration_data()
|
||||
openrc_config_data.set('SBINDIR', join_paths(get_option('prefix'), get_option('sbindir')))
|
||||
openrc_config_data.set('LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir'), meson.project_name()))
|
||||
|
||||
openrc_config_data_file = configure_file(
|
||||
input: 'tufmanager.in',
|
||||
output: 'tufmanager',
|
||||
configuration: openrc_config_data
|
||||
)
|
||||
|
||||
openrc = find_program ('openrc', required: false)
|
||||
|
||||
if openrc.found()
|
||||
install_data(
|
||||
openrc_config_data_file,
|
||||
install_dir: join_paths(get_option('sysconfdir'), 'init.d')
|
||||
)
|
||||
endif
|
21
data/openrc/tufmanager.in
Executable file
21
data/openrc/tufmanager.in
Executable file
@@ -0,0 +1,21 @@
|
||||
#!@SBINDIR@/openrc-run
|
||||
# Copyright 2020 Chris Cromer
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
command=@LIBEXECDIR@/tuf-server
|
||||
pidfile=/run/tufmanager/pid
|
||||
name="TUF Manager daemon"
|
||||
|
||||
depend()
|
||||
{
|
||||
need dbus
|
||||
}
|
17
data/runit/meson.build
Normal file
17
data/runit/meson.build
Normal file
@@ -0,0 +1,17 @@
|
||||
runit_config_data = configuration_data()
|
||||
runit_config_data.set('LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir'), meson.project_name()))
|
||||
|
||||
runit_config_data_file = configure_file(
|
||||
input: 'run.in',
|
||||
output: 'run',
|
||||
configuration: runit_config_data
|
||||
)
|
||||
|
||||
runit = find_program ('runit', required: false)
|
||||
|
||||
if runit.found()
|
||||
install_data(
|
||||
runit_config_data_file,
|
||||
install_dir: join_paths(get_option('sysconfdir'), 'runit', 'sv', 'tufmanager')
|
||||
)
|
||||
endif
|
3
data/runit/run.in
Executable file
3
data/runit/run.in
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
sv check dbus >/dev/null || exit 1
|
||||
exec @LIBEXECDIR@/tuf-server -f
|
1
data/s6/dependencies
Normal file
1
data/s6/dependencies
Normal file
@@ -0,0 +1 @@
|
||||
dbus
|
17
data/s6/meson.build
Normal file
17
data/s6/meson.build
Normal file
@@ -0,0 +1,17 @@
|
||||
s6_config_data = configuration_data()
|
||||
s6_config_data.set('LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir'), meson.project_name()))
|
||||
|
||||
s6_config_data_file = configure_file(
|
||||
input: 'run.in',
|
||||
output: 'run',
|
||||
configuration: s6_config_data
|
||||
)
|
||||
|
||||
s6 = find_program ('s6-init', required: false)
|
||||
|
||||
if s6.found()
|
||||
install_data(
|
||||
[s6_config_data_file, 'type', 'dependencies'],
|
||||
install_dir: join_paths(get_option('sysconfdir'), 's6', 'sv', 'tufmanager')
|
||||
)
|
||||
endif
|
3
data/s6/run.in
Normal file
3
data/s6/run.in
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/execlineb -P
|
||||
fdmove -c 2 1
|
||||
exec @LIBEXECDIR@/tuf-server -f
|
1
data/s6/type
Normal file
1
data/s6/type
Normal file
@@ -0,0 +1 @@
|
||||
longrun
|
17
data/systemd/meson.build
Normal file
17
data/systemd/meson.build
Normal file
@@ -0,0 +1,17 @@
|
||||
systemd_config_data = configuration_data()
|
||||
systemd_config_data.set('LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir'), meson.project_name()))
|
||||
|
||||
systemd_config_data_file = configure_file(
|
||||
input: 'tufmanager.service.in',
|
||||
output: 'tufmanager.service',
|
||||
configuration: systemd_config_data
|
||||
)
|
||||
|
||||
systemd = find_program ('systemd', required: false)
|
||||
|
||||
if systemd.found()
|
||||
install_data(
|
||||
systemd_config_data_file,
|
||||
install_dir: join_paths(get_option('prefix'), 'lib', 'systemd', 'system')
|
||||
)
|
||||
endif
|
10
data/systemd/tufmanager.service.in
Normal file
10
data/systemd/tufmanager.service.in
Normal file
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=TUF Manager Server
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile=/run/tufmanager/pid
|
||||
ExecStart=@LIBEXECDIR@/tuf-server
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user