]>
Commit | Line | Data |
---|---|---|
33cb80ed AF |
1 | #!/usr/bin/perl |
2 | ############################################################################### | |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2007 Michael Tremer & Christian Schmidt # | |
6 | # # | |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
21 | ||
22 | use strict; | |
23 | ||
24 | # enable only the following on debugging purpose | |
25 | #use warnings; | |
26 | #use CGI::Carp 'fatalsToBrowser'; | |
27 | ||
28 | require '/var/ipfire/general-functions.pl'; | |
29 | require "${General::swroot}/lang.pl"; | |
30 | require "${General::swroot}/header.pl"; | |
31 | ||
32 | #workaround to suppress a warning when a variable is used only once | |
33 | my @dummy = ( ${Header::colourred} ); | |
34 | undef (@dummy); | |
35 | ||
36 | my %color = (); | |
37 | my %mainsettings = (); | |
38 | &General::readhash("${General::swroot}/main/settings", \%mainsettings); | |
39 | &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); | |
40 | ||
41 | my %cgiparams=(); | |
42 | ||
43 | &Header::showhttpheaders(); | |
44 | &Header::getcgihash(\%cgiparams); | |
45 | &Header::openpage($Lang::tr{'status information'}, 1, ''); | |
46 | &Header::openbigbox('100%', 'left'); | |
47 | ||
48 | &Header::openbox('100%', 'left', 'Addon - Services'); | |
49 | ||
50 | my $paramstr=$ENV{QUERY_STRING}; | |
51 | my @param=split(/!/, $paramstr); | |
52 | if ($param[1] ne '') { | |
53 | my $temp = `/usr/local/bin/addonctrl @param[0] @param[1]`; | |
54 | } | |
55 | ||
56 | print <<END | |
57 | <div align='center'> | |
7d2ba062 AF |
58 | <table width='90%' cellspacing='2' border='0'> |
59 | <tr bgcolor='$color{'color20'}'> | |
33cb80ed AF |
60 | <td align='left'><b>Addon</b></td> |
61 | <td align='center' colspan=3><b>Bootconfiguration</b></td> | |
62 | <td align='center' colspan=2><b>Manual</b></td> | |
63 | <td align='left' width='50%'><b>Status</b></td> | |
64 | </tr> | |
65 | END | |
66 | ; | |
67 | ||
7d2ba062 AF |
68 | my $lines=0; # Used to count the outputlines to make different bgcolor |
69 | ||
33cb80ed AF |
70 | # Generate list of installed addon pak's |
71 | my @pak = `find /opt/pakfire/db/installed/meta-* | cut -d"-" -f2`; | |
72 | foreach (@pak) | |
73 | { | |
74 | chomp($_); | |
75 | ||
76 | # Check which of the paks are services | |
77 | my @svc = `find /etc/init.d/$_ | cut -d"/" -f4`; | |
78 | foreach (@svc) | |
79 | { | |
7d2ba062 AF |
80 | # blacklist some packages |
81 | # | |
82 | # alsa has trouble with the volume saving and was not really stopped | |
83 | # | |
33cb80ed | 84 | chomp($_); |
7d2ba062 AF |
85 | if ($_ ne "alsa") |
86 | { | |
87 | $lines++; | |
88 | if ($lines % 2) | |
89 | { | |
90 | print "<tr bgcolor='$color{'color22'}'>"; | |
91 | } | |
92 | else | |
93 | { | |
94 | print "<tr bgcolor='$color{'color20'}'>"; | |
95 | } | |
96 | print "<td align='left'>$_</td> "; | |
97 | my $status = isautorun($_); | |
98 | print "$status "; | |
99 | print "<td align='center'><A HREF=addonsvc.cgi?$_!enable>enable</A></td> "; | |
100 | print "<td align='center'><A HREF=addonsvc.cgi?$_!disable>disable</A></td> "; | |
101 | print "<td align='center'><A HREF=addonsvc.cgi?$_!start>start</A></td> "; | |
102 | print "<td align='center'><A HREF=addonsvc.cgi?$_!stop>stop</A></td> "; | |
103 | my $status = `/usr/local/bin/addonctrl $_ status`; | |
104 | $status =~ s/\\e\[[0-1]\;[0-9]+m//g; | |
105 | chomp($status); | |
106 | print "<td align='left'>$status</td> "; | |
107 | print "</tr>"; | |
108 | } | |
33cb80ed AF |
109 | } |
110 | } | |
111 | ||
112 | print "</table></div>\n"; | |
113 | ||
114 | &Header::closebox(); | |
115 | &Header::closebigbox(); | |
116 | &Header::closepage(); | |
117 | ||
118 | sub isautorun | |
119 | { | |
120 | my $cmd = $_[0]; | |
7d2ba062 | 121 | my $status = "<td align='center' bgcolor='${Header::colourblue}'><font color='white'><b>---</b></font></td>"; |
33cb80ed AF |
122 | my $init = `find /etc/rc.d/rc3.d/S??${cmd}`; |
123 | chomp ($init); | |
124 | if ($init ne '') { | |
125 | $status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>Ein</b></font></td>"; | |
126 | } | |
7d2ba062 AF |
127 | $init = `find /etc/rc.d/rc3.d/off/S??${cmd}`; |
128 | chomp ($init); | |
129 | if ($init ne '') { | |
130 | $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>Aus</b></font></td>"; | |
131 | } | |
132 | ||
33cb80ed AF |
133 | return $status; |
134 | } | |
135 |