Package: needrestart
Version: 3.5-1
Followup-For: Bug #972685

On 10/22/20 8:16 PM, Thomas Liske wrote:
> Hi,
> 
> thanks for the patch. Would it possible that you provide a updated patch 
>  compatible with upstream's git HEAD?
>


Hi,

You should be able to git am the patch attached to this message.
Note that i've used 'service' instead of invoke-run, to be consistent
with upstream code, so this will need further work on Debian side,
updating and refreshing the quilt '01-use-invoke-rc.d.diff' patch.

Regards,
Lorenzo
>From 6a7ae3df50ab24c833db3c1ba2d771688347097e Mon Sep 17 00:00:00 2001
From: Lorenzo Puliti <plore...@disroot.org>
Date: Fri, 23 Oct 2020 10:46:55 +0200
Subject: [PATCH] Add support for runit

When runit is used as init system, a native runscript exists
and is enabled, use 'sv' instead of 'service'.
If no native runscript exists (or is disabled) we fallback on 'service'
---
 needrestart | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/needrestart b/needrestart
index d5c94fd..7d70633 100755
--- a/needrestart
+++ b/needrestart
@@ -46,6 +46,7 @@ $Getopt::Std::STANDARD_HELP_VERSION++;
 
 my $LOGPREF = '[main]';
 my $is_systemd = -d q(/run/systemd/system);
+my $is_runit = -e q(/run/runit.stopit);
 my $is_tty = (-t *STDERR || -t *STDOUT || -t *STDIN);
 my $is_vm;
 my $is_container;
@@ -386,6 +387,14 @@ sub restart_cmd($) {
                (qw(systemctl restart), qq($rc.service));
            }
        }
+       elsif($is_runit && -d qq(/etc/sv/$rc)) {
+           if(-e qq(/etc/service/$rc)) {
+               (qw(sv restart), $rc);
+           }
+           else {
+               (q(service), $rc, q(restart));
+           }
+       }
        else {
            (q(service), $rc, q(restart));
        }
-- 
2.28.0

Reply via email to