diff options
author | Dmitry Bogatov <KAction@debian.org> | 2019-03-05 15:17:43 +0000 |
---|---|---|
committer | Dmitry Bogatov <KAction@debian.org> | 2019-03-05 15:17:43 +0000 |
commit | bad883cd8c4e4a2a520015141a4b685a85c450ba (patch) | |
tree | b1237bbf3475f3d2fe178dd34a839b2a44da703c | |
parent | 51fb67fb3fcec62888e0eccfaaaf366da1a2d31d (diff) |
Correctly create symlinks in /etc/service in post-inst on first revision of package, that introduced runscript. (Closes: #923233)
-rw-r--r-- | debian/changelog | 2 | ||||
-rwxr-xr-x | dh_runit | 17 | ||||
-rw-r--r-- | postinst-runit | 1 | ||||
-rw-r--r-- | postrm-runit | 1 | ||||
-rwxr-xr-x | runit-helper | 3 |
5 files changed, 21 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog index 90c3ea8..520f214 100644 --- a/debian/changelog +++ b/debian/changelog | |||
@@ -2,6 +2,8 @@ dh-runit (2.8.8) UNRELEASED; urgency=medium | |||
2 | 2 | ||
3 | * Do not create /etc/sv directory if there is no runscript (Closes: #923439) | 3 | * Do not create /etc/sv directory if there is no runscript (Closes: #923439) |
4 | + Thanks: Mathieu Mirmont <mat@parad0x.org> | 4 | + Thanks: Mathieu Mirmont <mat@parad0x.org> |
5 | * Correctly create symlinks in /etc/service in post-inst on first | ||
6 | revision of package, that introduced runscript. (Closes: #923233) | ||
5 | 7 | ||
6 | -- Dmitry Bogatov <KAction@debian.org> Thu, 28 Feb 2019 12:15:20 +0000 | 8 | -- Dmitry Bogatov <KAction@debian.org> Thu, 28 Feb 2019 12:15:20 +0000 |
7 | 9 | ||
@@ -10,11 +10,12 @@ use feature 'signatures'; | |||
10 | no warnings 'experimental'; | 10 | no warnings 'experimental'; |
11 | 11 | ||
12 | sub parse_options($opts) { | 12 | sub parse_options($opts) { |
13 | my $conf = { enable => 1 }; | 13 | my $conf = { enable => 1, since => '0.0-0' }; |
14 | for my $opt (split(/,/, $opts)) { | 14 | for my $opt (split(/,/, $opts)) { |
15 | given($opt) { | 15 | given($opt) { |
16 | when (/^disable$/) { $conf->{enable} = 0; }; | 16 | when (/^disable$/) { $conf->{enable} = 0; }; |
17 | when (/^name=(.*)$/) { $conf->{name} = $1; }; | 17 | when (/^name=(.*)$/) { $conf->{name} = $1; }; |
18 | when (/^since=(.*)$/) { $conf->{since} = $1; }; | ||
18 | when (/^logscript$/) { $conf->{logscript} = 1}; | 19 | when (/^logscript$/) { $conf->{logscript} = 1}; |
19 | when (/^defaults$/) { "do nothing"; }; | 20 | when (/^defaults$/) { "do nothing"; }; |
20 | default { error("unknown option `$opt'"); } | 21 | default { error("unknown option `$opt'"); } |
@@ -73,7 +74,8 @@ PKG: foreach my $pkg (@{$dh{DOPACKAGES}}) { | |||
73 | 74 | ||
74 | my $substitutions = { | 75 | my $substitutions = { |
75 | NAME => $name, | 76 | NAME => $name, |
76 | ENABLE => $conf->{enable} ? "yes" : "no" | 77 | ENABLE => $conf->{enable} ? "yes" : "no", |
78 | SINCE => $conf->{since} | ||
77 | }; | 79 | }; |
78 | 80 | ||
79 | runit_autoscript($pkg, 'postrm', $substitutions); | 81 | runit_autoscript($pkg, 'postrm', $substitutions); |
@@ -166,6 +168,17 @@ the rights of the dedicated user. Specifying this option produces | |||
166 | an error if the path argument names a directory that already | 168 | an error if the path argument names a directory that already |
167 | contains a F</log/run> script. | 169 | contains a F</log/run> script. |
168 | 170 | ||
171 | =item I<since> | ||
172 | |||
173 | Specify what version of package introduced runscript. Correct | ||
174 | installation of symlinks in F</etc/service> requires this information to | ||
175 | correctly distinguish cases, when system administrator deliberately | ||
176 | disabled service and case, when runscript was not provided in previous | ||
177 | version of package. See #923233. | ||
178 | |||
179 | If this option is not specified, it means that runscript was provided | ||
180 | all history of package. | ||
181 | |||
169 | =item I<defaults> | 182 | =item I<defaults> |
170 | 183 | ||
171 | If you don't need other options, specify this one. | 184 | If you don't need other options, specify this one. |
diff --git a/postinst-runit b/postinst-runit index 6110707..41fd76a 100644 --- a/postinst-runit +++ b/postinst-runit | |||
@@ -1,6 +1,7 @@ | |||
1 | # -*- shell-script -*- | 1 | # -*- shell-script -*- |
2 | export NAME='#NAME#' | 2 | export NAME='#NAME#' |
3 | export ENABLE='#ENABLE#' | 3 | export ENABLE='#ENABLE#' |
4 | export SINCE='#SINCE#' | ||
4 | 5 | ||
5 | # Unlike postrm, I can be sure, that runit-helper is present on | 6 | # Unlike postrm, I can be sure, that runit-helper is present on |
6 | # postinst. | 7 | # postinst. |
diff --git a/postrm-runit b/postrm-runit index d5748c9..9a912f1 100644 --- a/postrm-runit +++ b/postrm-runit | |||
@@ -1,6 +1,7 @@ | |||
1 | # -*- shell-script -*- | 1 | # -*- shell-script -*- |
2 | export NAME='#NAME#' | 2 | export NAME='#NAME#' |
3 | export ENABLE='#ENABLE#' | 3 | export ENABLE='#ENABLE#' |
4 | export SINCE='#SINCE' | ||
4 | 5 | ||
5 | # Unfortunately, we can not assume, that bin:runit-helper package | 6 | # Unfortunately, we can not assume, that bin:runit-helper package |
6 | # is installed at postrm stage. | 7 | # is installed at postrm stage. |
diff --git a/runit-helper b/runit-helper index 051cbfa..a9cab5b 100755 --- a/runit-helper +++ b/runit-helper | |||
@@ -23,7 +23,8 @@ postinst () { | |||
23 | 23 | ||
24 | # Fresh installation (not upgrade). It is important to not override | 24 | # Fresh installation (not upgrade). It is important to not override |
25 | # local admin decision (see #899242). | 25 | # local admin decision (see #899242). |
26 | if [ "${ENABLE}" = yes ] && [ -z "${previous}" ] ; then | 26 | if [ "${ENABLE}" = yes ] && \ |
27 | dpkg --compare-versions "${previous}" '<<' "${SINCE}" ; then | ||
27 | ln -sf "/etc/sv/$NAME" "/etc/runit/runsvdir/default/$NAME" | 28 | ln -sf "/etc/sv/$NAME" "/etc/runit/runsvdir/default/$NAME" |
28 | fi | 29 | fi |
29 | } | 30 | } |