Hi, > True. Here are patches. What do you think?
I haven't had time to test but the patch looks good to me, just an observation: to my experience /etc/init.d/${service} status is not always reliable in term of both results and exit codes, we will have the chance to fix a certain number of sysv init scripts because of this thanks Il giorno gio 16 mag 2019 alle ore 10:54 Dmitry Bogatov <kact...@debian.org> ha scritto: > > control: tags -1 +pending +patch > > [2019-05-13 14:35] Lorenzo Puliti <lorenzo.r...@gmail.com> > > Hi, > > > > In order to avoid conflicts, recent version of invoke-run interpreter > stops the sysv > > init scripts before starting the run service. > > Please note that this logic, when applied to daemons like dbus, slim, > sddm, lightdm > > (and possibly others) will break the graphic session, so there is need > for a way > > to prevent the sysv script being replaced by the run script while the > graphic session > > is active. > > This also will need support in dh-runit. > > True. Here are patches. What do you think? > > From 66e9071165250793d8900f17cd5b35ca7b45526b Mon Sep 17 00:00:00 2001 > From: Dmitry Bogatov <kact...@debian.org> > Date: Tue, 14 May 2019 10:45:06 +0000 > Subject: [PATCH] invoke-run: add option to not stop sysv scripts > > Closes: #928935 > --- > debian/contrib/lib/invoke-run | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/debian/contrib/lib/invoke-run b/debian/contrib/lib/invoke-run > index a424b73..9fa5c59 100755 > --- a/debian/contrib/lib/invoke-run > +++ b/debian/contrib/lib/invoke-run > @@ -40,7 +40,17 @@ if [ -r "/etc/default/${service}" ] ; then > fi > > readonly initscript="/etc/init.d/${service}" > +readonly noreplace="/var/lib/runit/noreplace/${service}" > + > if [ -x "${initscript}" ] ; then > + # Stopping some services (e.g display manager) is disruptive > + # and must be done only manually by user. > + if [ -f "${noreplace}" ] ; then > + if "${initscript}" status >/dev/null 2>&1 ; then > + sv down "${service}" > + exit 0 > + fi > + fi > "${initscript}" stop > fi > > And here is patch for dh_runit. It may be more convenient to see it at > salsa.debian.org/runit-team/dh-runit. > > From cb411affcbc2eb183ee5f35e50c3863c0b94f98a Mon Sep 17 00:00:00 2001 > From: Dmitry Bogatov <kact...@debian.org> > Date: Tue, 14 May 2019 15:41:52 +0000 > Subject: [PATCH] Add option to mark service as non-restartable > > --- > dh_runit | 18 ++++++++++++++++++ > t/924903.t | 5 ++++- > t/928935.t | 10 ++++++++++ > 3 files changed, 32 insertions(+), 1 deletion(-) > create mode 100644 t/928935.t > > diff --git a/dh_runit b/dh_runit > index 5ed55b5..4c9820e 100755 > --- a/dh_runit > +++ b/dh_runit > @@ -5,6 +5,7 @@ use v5.10.1; > use strict; > use Debian::Debhelper::Dh_Lib; > use File::Find; > +use File::Path qw(make_path); > use File::stat; > use feature 'signatures'; > no warnings 'experimental'; > @@ -17,6 +18,7 @@ sub parse_options($opts) { > when (/^name=(.*)$/) { $conf->{name} = $1; }; > when (/^since=(.*)$/) { $conf->{since} = $1; }; > when (/^logscript$/) { $conf->{logscript} = 1}; > + when (/^noreplace$/) { $conf->{noreplace} = 1}; > when (/^defaults$/) { "do nothing"; }; > default { error("unknown option `$opt'"); } > } > @@ -59,6 +61,13 @@ PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { > my $conf = parse_options($opts); > my $name = $conf->{name} || basename($path); > > + if ($conf->{noreplace}) { > + make_path("${tmp}/var/lib/runit/noreplace/"); > + open(my $fh, ">", "${tmp}/var/lib/runit/noreplace/${name}") > + || die $!; > + close($fh); > + } > + > if ( -f $path) { > install_dir("$sv_dir/$name"); > install_prog($path, "$sv_dir/$name/run"); > @@ -182,6 +191,15 @@ version of package. See #923233. > If this option is not specified, it means that runscript was provided > all history of package. > > +=item I<noreplace> > + > +Mark service as non-restartible. Interpreter B<invoke-run>, provided by > +I<runit> package does not stop sysvinit-managed instance of service to > +replace it with runit-managed instance when service is marked as > +non-restartible. > + > +Display managers (xdm, kdm, ...) are examples of non-restartible services. > + > =item I<defaults> > > If you don't need other options, specify this one. > diff --git a/t/924903.t b/t/924903.t > index 710ea39..b969314 100644 > --- a/t/924903.t > +++ b/t/924903.t > @@ -1,7 +1,7 @@ > #!/usr/bin/perl > use strict; > use warnings; > -use Test::More tests => 3; > +use Test::More tests => 4; > use File::stat; > use T; > > @@ -11,3 +11,6 @@ ok(-d $path, 'supervise directory correctly created'); > my $info = stat($path); > my $mode = sprintf("%o", $info->mode & 0777); > is($mode, '700', 'supervise directory have conservative permissions'); > + > +my $noreplace = 'debian/dh-runit-test/var/lib/runit/noreplace/test'; > +ok(!-f $noreplace, 'noreplace file is correctly absent'); > diff --git a/t/928935.t b/t/928935.t > new file mode 100644 > index 0000000..e31756b > --- /dev/null > +++ b/t/928935.t > @@ -0,0 +1,10 @@ > +#!/usr/bin/perl > +use strict; > +use warnings; > +use Test::More tests => 2; > +use T; > + > +system_ok('dh_runit', 'debian/test.runscript', 'name=test,noreplace'); > + > +my $noreplace = 'debian/dh-runit-test/var/lib/runit/noreplace/test'; > +ok(-f $noreplace, 'noreplace file correctly created'); > > -- > Note, that I send and fetch email in batch, once every 24 hours. > If matter is urgent, try https://t.me/kaction > > -- >