blob: 5563227d553cd8aa5a34fac13307e157fa88d668 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001# Hack in support for an "exclude" config option for the init module, so
2# we can hide certain system services that shouldn't really be configurable
3# via the web interface
4#
5# Upstream-status: Pending
6#
7# Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
8# Signed-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
14diff --git a/init/index.cgi b/init/index.cgi
15index d48b793..30dafd4 100755
16--- a/init/index.cgi
17+++ b/init/index.cgi
18@@ -45,19 +45,20 @@ elsif ($init_mode eq "init" && $access{'bootup'}) {
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
52diff --git a/init/init-lib.pl b/init/init-lib.pl
53index ead21ed..b41794b 100755
54--- a/init/init-lib.pl
55+++ b/init/init-lib.pl
56@@ -119,8 +119,9 @@ List boot time action names from init.d, such as httpd and cron.
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@@ -128,7 +129,7 @@ foreach $f (sort { lc($a) cmp lc($b) } readdir(DIR)) {
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--
772.0.0
78