commit 4b9d262204bc5be97b84993922771e0db3ceb0ac
Author: Lorenzo Puliti <plorenzo@disroot.org>
Date:   Fri Oct 23 10:46:55 2020 +0200

    [Core] Add support for runit (fixes Debian Bug#972685).
    
    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'

diff -Naur needrestart-3.5.orig/needrestart needrestart-3.5/needrestart
--- needrestart-3.5.orig/needrestart	2021-04-09 11:20:51.000000000 +0200
+++ needrestart-3.5/needrestart	2021-04-09 11:23:36.106602774 +0200
@@ -46,6 +46,7 @@
 
 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 @@
 		(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(invoke-rc.d), $rc, q(restart));
 	}
