From d19f8bcffadb70560a8a137e985d549ebf10c818 Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Wed, 5 Aug 2020 23:18:39 -0400 Subject: [PATCH] add systemd --- contrib/meson.build | 1 + contrib/openrc/meson.build | 2 ++ contrib/systemd/meson.build | 17 +++++++++++++++++ contrib/systemd/tufmanager.service.in | 6 ++++++ data/dbus/org.tuf.manager.server.service.in | 1 + meson.build | 1 - meson_options.txt | 6 ++++++ 7 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 contrib/systemd/meson.build create mode 100644 contrib/systemd/tufmanager.service.in diff --git a/contrib/meson.build b/contrib/meson.build index 13fae7f..b8c4f5c 100644 --- a/contrib/meson.build +++ b/contrib/meson.build @@ -1 +1,2 @@ subdir('openrc') +subdir('systemd') diff --git a/contrib/openrc/meson.build b/contrib/openrc/meson.build index 5f256e5..7ef9247 100644 --- a/contrib/openrc/meson.build +++ b/contrib/openrc/meson.build @@ -1,3 +1,5 @@ +openrc = get_option('openrc') + 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())) diff --git a/contrib/systemd/meson.build b/contrib/systemd/meson.build new file mode 100644 index 0000000..e8a6d2d --- /dev/null +++ b/contrib/systemd/meson.build @@ -0,0 +1,17 @@ +systemd = get_option('systemd') + +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 +) + +if systemd + install_data( + systemd_config_data_file, + install_dir: join_paths(get_option('prefix'), 'lib', 'systemd', 'system') + ) +endif diff --git a/contrib/systemd/tufmanager.service.in b/contrib/systemd/tufmanager.service.in new file mode 100644 index 0000000..becea24 --- /dev/null +++ b/contrib/systemd/tufmanager.service.in @@ -0,0 +1,6 @@ +[Unit] +Description=TUF Manager Server + +[Service] +Type=forking +ExecStart=@LIBEXECDIR@/tuf-server diff --git a/data/dbus/org.tuf.manager.server.service.in b/data/dbus/org.tuf.manager.server.service.in index c286727..ba9ec82 100644 --- a/data/dbus/org.tuf.manager.server.service.in +++ b/data/dbus/org.tuf.manager.server.service.in @@ -2,3 +2,4 @@ Name=org.tuf.manager.server Exec=@LIBEXECDIR@/tuf-server User=root +SystemdService=tufmanager.service diff --git a/meson.build b/meson.build index 98c89b2..cb9afb7 100644 --- a/meson.build +++ b/meson.build @@ -21,7 +21,6 @@ add_global_arguments( always_authenticated = get_option('always-authenticated') build_cli = get_option('build-cli') build_gui = get_option('build-gui') -openrc = get_option('openrc') subdir('po') subdir('data') diff --git a/meson_options.txt b/meson_options.txt index 8436a15..dd2b918 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -34,3 +34,9 @@ option( value: false, description: 'Install OpenRC script' ) +option( + 'systemd', + type : 'boolean', + value: false, + description: 'Install systemd unit' +)