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