From 313c3b94bb413fbf8e68f215fb7c506bbac17ca5 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Thu, 9 May 2024 01:17:49 +0100 Subject: [PATCH] systemd: add RuntimeDirectoryPreserve support --- cookbooks/systemd/resources/service.rb | 1 + cookbooks/systemd/templates/default/service.erb | 3 +++ 2 files changed, 4 insertions(+) diff --git a/cookbooks/systemd/resources/service.rb b/cookbooks/systemd/resources/service.rb index 4a2480489..3a9f0b893 100644 --- a/cookbooks/systemd/resources/service.rb +++ b/cookbooks/systemd/resources/service.rb @@ -55,6 +55,7 @@ property :exec_reload, String property :runtime_max_sec, Integer property :runtime_directory, String property :runtime_directory_mode, Integer +property :runtime_directory_preserve, [true, false, String] property :state_directory, String property :state_directory_mode, Integer property :cache_directory, String diff --git a/cookbooks/systemd/templates/default/service.erb b/cookbooks/systemd/templates/default/service.erb index b979703dd..197d8bddf 100644 --- a/cookbooks/systemd/templates/default/service.erb +++ b/cookbooks/systemd/templates/default/service.erb @@ -127,6 +127,9 @@ RuntimeDirectory=<%= @runtime_directory %> <% if @runtime_directory_mode -%> RuntimeDirectoryMode=<%= sprintf("0%o", @runtime_directory_mode) %> <% end -%> +<% if @runtime_directory_preserve -%> +RuntimeDirectoryPreserve=<%= @runtime_directory_preserve %> +<% end -%> <% if @state_directory -%> StateDirectory=<%= @state_directory %> <% end -%> -- 2.39.5