xref: /openbmc/openbmc/meta-openembedded/meta-webserver/recipes-webadmin/webmin/files/init-exclude.patch (revision 8e7b46e2350c3689938f309eaca929aada20b5a0)
1Hack in support for an "exclude" config option for the init module, so
2we can hide certain system services that shouldn't really be configurable
3via the web interface
4
5Upstream-Status: Pending
6
7Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
8Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
9---
10 init/index.cgi   | 27 ++++++++++++++-------------
11 init/init-lib.pl |  5 +++--
12 2 files changed, 17 insertions(+), 15 deletions(-)
13
14Index: webmin-1.850/init/index.cgi
15===================================================================
16--- webmin-1.850.orig/init/index.cgi
17+++ webmin-1.850/init/index.cgi
18@@ -45,19 +45,20 @@ elsif ($init_mode eq "init" && $access{'
19 					     : "$config{'init_dir'}/$ac[0]");
20 		}
21 	@runlevels = &list_runlevels();
22-	foreach $r (@runlevels) {
23-		foreach $w ("S", "K") {
24-			foreach $a (&runlevel_actions($r, $w)) {
25-				@ac = split(/\s+/, $a);
26-				if (!$nodemap{$ac[2]}) {
27-					push(@acts, $ac[1]);
28-					push(@actsl,
29-					     "1+$r+$ac[0]+$ac[1]+$ac[2]+$w");
30-					push(@actsf, "$config{'init_base'}/rc$r.d/$w$ac[0]$ac[1]");
31-					}
32-				}
33-			}
34-		}
35+	# Assume there won't be any of these broken actions
36+	#foreach $r (@runlevels) {
37+	#	foreach $w ("S", "K") {
38+	#		foreach $a (&runlevel_actions($r, $w)) {
39+	#			@ac = split(/\s+/, $a);
40+	#			if (!$nodemap{$ac[2]}) {
41+	#				push(@acts, $ac[1]);
42+	#				push(@actsl,
43+	#				     "1+$r+$ac[0]+$ac[1]+$ac[2]+$w");
44+	#				push(@actsf, "$config{'init_base'}/rc$r.d/$w$ac[0]$ac[1]");
45+	#				}
46+	#			}
47+	#		}
48+	#	}
49
50 	# For each action, look at /etc/rc*.d/* files to see if it is
51 	# started at boot
52Index: webmin-1.850/init/init-lib.pl
53===================================================================
54--- webmin-1.850.orig/init/init-lib.pl
55+++ webmin-1.850/init/init-lib.pl
56@@ -124,8 +124,9 @@ List boot time action names from init.d,
57 =cut
58 sub list_actions
59 {
60-local($dir, $f, @stbuf, @rv);
61+local($dir, $f, @stbuf, @rv, @exclude);
62 $dir = $config{init_dir};
63+@exclude = split(/,/, $config{exclude});
64 opendir(DIR, $dir);
65 foreach $f (sort { lc($a) cmp lc($b) } readdir(DIR)) {
66 	if ($f eq "." || $f eq ".." || $f =~ /\.bak$/ || $f eq "functions" ||
67@@ -133,7 +134,7 @@ foreach $f (sort { lc($a) cmp lc($b) } r
68 	    -d "$dir/$f" || $f =~ /\.swp$/ || $f eq "skeleton" ||
69 	    $f =~ /\.lock$/ || $f =~ /\.dpkg-(old|dist)$/ ||
70 	    $f =~ /^\.depend\./ || $f eq '.legacy-bootordering' ||
71-	    $f =~ /^mandrake/) { next; }
72+	    $f =~ /^mandrake/ || grep {$_ eq $f} @exclude ) { next; }
73 	if (@stbuf = stat("$dir/$f")) {
74 		push(@rv, "$f $stbuf[1]");
75 		}
76