[pkg-lighttpd] r540 - lighttpd/trunk/debian
Arno Töll
atoell-guest at alioth.debian.org
Sun Jun 12 22:09:40 UTC 2011
Author: atoell-guest
Date: 2011-06-12 22:09:39 +0000 (Sun, 12 Jun 2011)
New Revision: 540
Modified:
lighttpd/trunk/debian/changelog
lighttpd/trunk/debian/lighty-enable-mod
lighttpd/trunk/debian/lighty-enable-mod.1
Log:
Propose a fix for #629638
Modified: lighttpd/trunk/debian/changelog
===================================================================
--- lighttpd/trunk/debian/changelog 2011-04-28 10:43:30 UTC (rev 539)
+++ lighttpd/trunk/debian/changelog 2011-06-12 22:09:39 UTC (rev 540)
@@ -1,3 +1,10 @@
+lighttpd (1.4.28-6) UNRELEASED; urgency=low
+
+ * Fix "lighty-enable-mod should return non-zero on fail" Update script to
+ leave with appropriate exit status (Closes: #629638)
+
+ -- Arno Töll <debian at toell.net> Sun, 12 Jun 2011 23:04:36 +0200
+
lighttpd (1.4.28-5) unstable; urgency=low
* Build with sbuilder to avoid linking to non-existed packages.
Modified: lighttpd/trunk/debian/lighty-enable-mod
===================================================================
--- lighttpd/trunk/debian/lighty-enable-mod 2011-04-28 10:43:30 UTC (rev 539)
+++ lighttpd/trunk/debian/lighty-enable-mod 2011-06-12 22:09:39 UTC (rev 540)
@@ -26,12 +26,26 @@
my @todo = ();
my $enabling = 1;
+#--- some defaults
+use constant {
+ EXIT_OK => 0,
+ EXIT_FAILURE => 1,
+ EXIT_NO_ACTION => 2
+};
+
#--- first check if we enabling or disabling
if ($0 =~ /disable-mod$/) {
#--- disabling mode
$enabling = 0;
}
+
+sub mydie {
+ my $reason = shift;
+ print($reason);
+ exit(EXIT_FAILURE);
+}
+
#--- list of available modules
my @files = bsd_glob($confdir.'conf-available/*.conf');
foreach my $file (@files) {
@@ -71,12 +85,13 @@
@todo = @ARGV;
}
-
+my $exit_status = EXIT_OK;
#--- activate (link) or deactivate (remove) module
foreach my $do (@todo) {
if (! exists($available{$do})) {
print("Ignoring unknown module: $do\n");
+ $exit_status = EXIT_NO_ACTION;
next;
}
@@ -89,7 +104,7 @@
unless ( -f $target ) {
# scan for a dependency line
local *MOD;
- open(MOD, "< $source") || die("can't read $source: $!");
+ open(MOD, "< $source") || mydie("can't read $source: $!");
while(my $i = <MOD>) {
if ($i =~ m/# -\*- depends: ([-\w, ]+) -\*-/) {
my @matches = split(/,\s+/, $1);
@@ -103,22 +118,26 @@
}
else
{
- die("Unresolved dependency: $module\n");
+ mydie("Unresolved dependency: $module\n");
}
}
last;
}
}
close(MOD);
- if (symlink("../conf-available/" . basename($available{$do}), $target)) {
+ if (symlink("../conf-available/" . basename($available{$do}), $target)) {
print "Enabling $do: ok\n";
}
else {
print "failure: $!\n";
+ $exit_status = EXIT_FAILURE;
}
}
else {
print "already enabled\n";
+ # Set exit status only, if no more severe problem
+ # occured so far
+ $exit_status = EXIT_NO_ACTION if $exit_status != EXIT_FAILURE;
}
}
@@ -127,14 +146,14 @@
print qq{Disabling $do\n};
my $target = sprintf("%s/conf-enabled/%s", $confdir,basename($enabled{$do}));
my $source = $available{$do};
-
+
# scan for a reverse dependency line
foreach my $available_module (keys %available) {
if ($available_module eq $do) {
next;
}
local *MOD;
- open(MOD, "< $available{$available_module}") || die("can't read $available{$available_module}: $!");
+ open(MOD, "< $available{$available_module}") || mydie("can't read $available{$available_module}: $!");
while(my $i = <MOD>) {
if ($i =~ m/# -\*- depends: ([-\w, ]+) -\*-/) {
my @matches = split(/,\s+/, $1);
@@ -146,15 +165,17 @@
}
last;
}
- }
+ }
}
close(MOD);
unlink($target);
} else {
print qq{Already disabled $do\n};
+ $exit_status = EXIT_NO_ACTION if $exit_status != EXIT_FAILURE;
}
}
}
print "Run /etc/init.d/lighttpd force-reload to enable changes\n";
+exit($exit_status);
Modified: lighttpd/trunk/debian/lighty-enable-mod.1
===================================================================
--- lighttpd/trunk/debian/lighty-enable-mod.1 2011-04-28 10:43:30 UTC (rev 539)
+++ lighttpd/trunk/debian/lighty-enable-mod.1 2011-06-12 22:09:39 UTC (rev 540)
@@ -3,6 +3,7 @@
lighty-enable-mod, lighty-disable-mod \- enable or disable configuration in lighttpd server
.SH SYNOPSIS
lighty-enable-mod [module]
+.br
lighty-disable-mod [module]
.SH DESCRIPTION
This manual page documents briefly the lighty-enable-mod and
@@ -11,7 +12,50 @@
lighty-enable-mod and lighty-disable-mod are programs that enable
(and respectively disable) the specified configuration file within
lighttpd configuration.
+
+Both programs can be run interactively or from command
+line. If either program is called without any arguments, an input
+prompt is displayed to the user, where he might choose among available
+.I "lighttpd"
+modules. Immediate action is taken, if a module name was given on the
+command line.
+
+.SS EXIT STATUS
+
+Both programs indicate failure in their exit status. lighty-enable-mod or
+lighty-disable-mod respectively may leave execution with one of the following
+exit codes:
+.br
+.TP 5
+.B "0"
+denotes success
+.TP 5
+.B "1"
+denotes a fatal error (e.g., a module could not be enabled, or a dependency was not found)
+.TP 5
+.B "2"
+denotes a minor flaw (e.g., a module was not enabled because it was already loaded before)
+.SH DEPENDENCIES
+Debian allows
+.I "lighttpd"
+modules to formulate dependencies to other modules they depend on. Configuration
+files are scanned for dependencies upon load or
+unload of modules, not at runtime of the web server. Such a magic line has the following format:
+.nf
+
+ # -*- depends: module[, module] -*-
+
+.fi
+
+and may appear anywhere in the file. If such a line is found, the extracted name
+is interpreted as dependency to another
+.I "lighttpd"
+module. lighty-enable-mod will seek available configurations to satisfy this
+dependency and will recursively enable all dependencies found on its way.
+lighty-disable-mod will disable reverse dependencies recursively.
+
.SH SEE ALSO
lighttpd(1)
.SH AUTHOR
-eloy at debian.org
+Program and man pages were originally written by Krzysztof Krzyżaniak
+<eloy at debian.org> and later modified by Arno Töll <debian at toell.net>
More information about the pkg-lighttpd-maintainers
mailing list