From f300bd7f5bd42ec17f41b23a1a935f4b6ed5579a Mon Sep 17 00:00:00 2001 From: iliajie Date: Sat, 10 Dec 2022 15:14:00 +0200 Subject: [PATCH] Add support for more options in unit section in `systemd` --- init/init-lib.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/init/init-lib.pl b/init/init-lib.pl index c42282f41..e25a6a1b3 100644 --- a/init/init-lib.pl +++ b/init/init-lib.pl @@ -2346,6 +2346,15 @@ my $cfile = &get_systemd_root($name)."/".$name; &open_lock_tempfile(CFILE, ">$cfile"); &print_tempfile(CFILE, "[Unit]\n"); &print_tempfile(CFILE, "Description=$desc\n") if ($desc); +if (ref($opts)) { + &print_tempfile(CFILE, "Before=$opts->{'before'}\n") if ($opts->{'before'}); + &print_tempfile(CFILE, "After=$opts->{'after'}\n") if ($opts->{'after'}); + &print_tempfile(CFILE, "Wants=$opts->{'wants'}\n") if ($opts->{'wants'}); + &print_tempfile(CFILE, "Requires=$opts->{'requires'}\n") if ($opts->{'requires'}); + &print_tempfile(CFILE, "Conflicts=$opts->{'conflicts'}\n") if ($opts->{'conflicts'}); + &print_tempfile(CFILE, "OnFailure=$opts->{'onfailure'}\n") if ($opts->{'onfailure'}); + &print_tempfile(CFILE, "OnSuccess=$opts->{'onsuccess'}\n") if ($opts->{'onsuccess'}); + } &print_tempfile(CFILE, "\n"); &print_tempfile(CFILE, "[Service]\n"); &print_tempfile(CFILE, "ExecStart=$start\n");