File: restart.patch

package info (click to toggle)
wwwconfig-common 0.3.0
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 488 kB
  • sloc: sh: 952; makefile: 5
file content (49 lines) | stat: -rw-r--r-- 1,813 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Package: wwwconfig-common
Version: 0.0.47
Severity: important
Tags: patch

If the command "/etc/init.d/$A restart" called from restart.sh fails
(for example, if the web server can not be started because port 80 is
already used by another program), the script will stop and fail, making
the postinst script of the calling package fail as well.

I believe that restart.sh should catch the error and return it in the
"error" environment variable, so postinst (or another calling script) can
handle it in the way it sees fit.

See (RC) bug #398638 for an example (package w3c-markup-validator).

The following patch fixes it for me; there may be other ways to do it.
It works with a modified version of w3c-markup-validator (where postinst
has been modified to notice the error), but I obviously can't upload the
modified package for now.

--- restart.sh	2006-10-11 21:31:57.000000000 +0200
+++ restart.sh.new	2006-11-17 20:14:35.000000000 +0100
@@ -33,7 +33,10 @@
        if [ "$verify" != "$restart" ] ; then
            log="${log}$A needs to be restarted."
                if [ -x /etc/init.d/$A ] ; then
-               /etc/init.d/$A restart >/dev/null 2>&1 3>&1 4>&1 5>&1
+               if ! /etc/init.d/$A restart >/dev/null 2>&1 3>&1 4>&1 5>&1; then
+		   status="error"
+                  error="ERROR! /etc/init.d/$A returned an error, $A could not be restarted."
+               fi
            else
                status="error"
                error="ERROR! But /etc/init.d/$A is not installed (or not executable)."


-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-686-bigmem
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

-- no debconf information