/usr/sbin/lighty-enable-mod is in lighttpd 1.4.28-2ubuntu4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | #!/usr/bin/perl -w
#
# Copyright (c) 2006 Krzysztof Krzyzaniak
#
# Contains changes from:
# - Tobias Gruetzmacher <tobias@portfolio16.de>
#
# You may distribute under the terms of either the GNU General Public
# License[1] or the Artistic License[2].
#
# [1] http://www.gnu.org/licenses/gpl.html
# [2] http://www.perl.com/pub/a/language/misc/Artistic.html
#
use strict;
use Term::ReadLine;
use File::Basename;
use File::Glob ':glob';
use File::stat;
#--- some initializations
my $confdir = "/etc/lighttpd/";
my %available = ();
my %enabled = ();
my @todo = ();
my %moduledeps = ();
my $enabling = 1;
#--- first check if we enabling or disabling
if ($0 =~ /disable-mod$/) {
#--- disabling mode
$enabling = 0;
}
#--- list of available modules
my @files = bsd_glob($confdir.'conf-available/*.conf');
print "Available modules: ";
foreach my $file (@files) {
if (basename($file) =~ /^\d+\-([\w\-\.]+)\.conf$/) {
$available{$1} = $file;
print qq{$1 };
}
}
print "\n";
#--- list of already enabled modules
@files = bsd_glob($confdir.'conf-enabled/*.conf');
print "Already enabled modules: ";
foreach my $file (@files) {
if (basename($file) =~ /^\d+\-([\w\-\.]+)\.conf$/) {
$enabled{$1} = $file;
print qq{$1 };
}
}
print "\n";
unless (defined($ARGV[0])) {
my $prompt = $enabling ? 'Enable module: ' : 'Disable module: ';
my $term = new Term::ReadLine $prompt;
my $OUT = $term->OUT || \*STDOUT;
my $var = lc($term->readline($prompt));
@todo = split(/ /, $var);
}
else {
@todo = @ARGV;
}
#--- activate (link) or deactivate (remove) module
foreach my $do (@todo) {
if ($enabling) {
next unless defined($available{$do});
my $target = sprintf("%s/conf-enabled/%s", $confdir,basename($available{$do}));
print qq{Enabling $do: };
my $st = stat($target);
unless ( -f $target ) {
if (symlink("../conf-available/" . basename($available{$do}), $target)) {
print "ok\n";
}
else {
print "failure: $!\n";
}
}
else {
print "already enabled\n";
}
#--- check dependencies
for my $module (@{$moduledeps{$do}})
{
unless ( -f $target && -l $target )
{
print qq{Module $do depends on module $module which is not activated.\n};
}
}
}
else {
if (defined($enabled{$do})) {
print qq{Disabling $do\n};
my $target = sprintf("%s/conf-enabled/%s", $confdir,basename($enabled{$do}));
unlink($target);
} else {
print qq{Already disabled $do\n};
}
}
}
print "Run /etc/init.d/lighttpd force-reload to enable changes\n";
|