[vte/wip/systemd: 4/5] systemd: Install config drop-in for vte-spawn-.scope



commit beed4954900041ddf7e7f18b58360ae89b057121
Author: Christian Persch <chpe src gnome org>
Date:   Tue Feb 4 16:10:26 2020 +0100

    systemd: Install config drop-in for vte-spawn-.scope

 meson.build               |  4 ++++
 src/meson.build           | 10 ++++++++++
 src/systemd.cc            |  1 -
 src/vte-spawn-.scope.conf |  6 ++++++
 4 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index 845acb01..6963a19c 100644
--- a/meson.build
+++ b/meson.build
@@ -93,6 +93,10 @@ vte_localedir = get_option('localedir')
 vte_prefix = get_option('prefix')
 vte_sysconfdir = get_option('sysconfdir')
 
+# It is correct for this to be in ${prefix}/lib, even on systems where that
+# does not match ${libdir}. This is what systemd uses on such platforms.
+vte_systemduserunitdir = vte_prefix / 'lib' / 'systemd' / 'user'
+
 # Debug
 
 enable_debug = get_option('debugg') or get_option('debug') or get_option('buildtype').contains('debug')
diff --git a/src/meson.build b/src/meson.build
index 4242dd61..352b5af9 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -563,6 +563,16 @@ vte_sh = configure_file(
   install_dir: vte_sysconfdir / 'profile.d',
 )
 
+# Systemd integration
+
+if host_machine.system() == 'linux'
+  install_data(
+    sources: 'vte-spawn-.scope.conf',
+    install_dir: vte_systemduserunitdir / 'vte-spawn-.scope.d',
+    rename: 'defaults.conf'
+  )
+endif
+
 # Demo application
 
 subdir('app')
diff --git a/src/systemd.cc b/src/systemd.cc
index 4ba40c6a..eeefd2f8 100644
--- a/src/systemd.cc
+++ b/src/systemd.cc
@@ -65,7 +65,6 @@ create_scope_for_pid_sync(pid_t pid,
         // Unit properties
         g_variant_builder_open(builder, G_VARIANT_TYPE("a(sv)"));
 
-        g_variant_builder_add(builder, "(sv)", "CollectMode", g_variant_new_string("inactive-or-failed"));
         g_variant_builder_add(builder, "(sv)", "Description", g_variant_new_string(description.get()));
 
         g_variant_builder_open(builder, G_VARIANT_TYPE("(sv)"));
diff --git a/src/vte-spawn-.scope.conf b/src/vte-spawn-.scope.conf
new file mode 100644
index 00000000..51ef27df
--- /dev/null
+++ b/src/vte-spawn-.scope.conf
@@ -0,0 +1,6 @@
+[Unit]
+CollectMode=inactive-or-failed
+
+[Scope]
+KillMode=process
+TimeoutStopSec=5s


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]