]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/pakfire.cgi
7c560bfbf249f58ceb248505bf9fc9d519c9fc3d
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2011 Michael Tremer & Christian Schmidt #
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. #
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. #
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/>. #
20 ###############################################################################
24 # enable only the following on debugging purpose
26 #use CGI::Carp 'fatalsToBrowser';
28 require '/var/ipfire/general-functions.pl';
29 require "${General::swroot}/lang.pl";
30 require "${General::swroot}/header.pl";
31 require "/opt/pakfire/lib/functions.pl";
33 my %pakfiresettings=();
34 my $errormessage = '';
36 my %mainsettings = ();
38 &Header
::showhttpheaders
();
40 $pakfiresettings{'ACTION'} = '';
41 $pakfiresettings{'VALID'} = '';
43 $pakfiresettings{'INSPAKS'} = '';
44 $pakfiresettings{'DELPAKS'} = '';
46 sub refreshpage
{&Header
::openbox
( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header
::closebox
();}
48 &Header
::getcgihash
(\
%pakfiresettings);
50 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
51 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
53 &Header
::openpage
($Lang::tr
{'pakfire configuration'}, 1);
54 &Header
::openbigbox
('100%', 'left', '', $errormessage);
56 if ($pakfiresettings{'ACTION'} eq 'install'){
57 $pakfiresettings{'INSPAKS'} =~ s/\|/\ /g;
58 if ("$pakfiresettings{'FORCE'}" eq "on") {
59 my $command = "/usr/local/bin/pakfire install --non-interactive --no-colors $pakfiresettings{'INSPAKS'} &>/dev/null &";
61 system("/bin/sleep 1");
63 &Header
::openbox
("100%", "center", $Lang::tr
{'request'});
64 my @output = `/usr/local/bin/pakfire resolvedeps --no-colors $pakfiresettings{'INSPAKS'}`;
66 <table><tr><td colspan='2'>$Lang::tr{'pakfire install package'}.$pakfiresettings{'INSPAKS'}.$Lang::tr{'pakfire possible dependency'}
70 $_ =~ s/\\e\[[0-1]\;[0-9]+m//g;
75 <tr><td colspan='2'>$Lang::tr{'pakfire accept all'}
76 <tr><td colspan='2'>
77 <tr><td align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
78 <input type='hidden' name='INSPAKS' value='$pakfiresettings{'INSPAKS'}' />
79 <input type='hidden' name='FORCE' value='on' />
80 <input type='hidden' name='ACTION' value='install' />
81 <input type='image' alt='$Lang::tr{'install'}' title='$Lang::tr{'install'}' src='/images/go-next.png' />
84 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
85 <input type='hidden' name='ACTION' value='' />
86 <input type='image' alt='$Lang::tr{'abort'}' title='$Lang::tr{'abort'}' src='/images/dialog-error.png' />
91 &Header
::closebigbox
();
95 } elsif ($pakfiresettings{'ACTION'} eq 'remove') {
97 $pakfiresettings{'DELPAKS'} =~ s/\|/\ /g;
98 if ("$pakfiresettings{'FORCE'}" eq "on") {
99 my $command = "/usr/local/bin/pakfire remove --non-interactive --no-colors $pakfiresettings{'DELPAKS'} &>/dev/null &";
101 system("/bin/sleep 1");
103 &Header
::openbox
("100%", "center", $Lang::tr
{'request'});
104 my @output = `/usr/local/bin/pakfire resolvedeps --no-colors $pakfiresettings{'DELPAKS'}`;
106 <table><tr><td colspan='2'>$Lang::tr{'pakfire uninstall package'}.$pakfiresettings{'DELPAKS'}.$Lang::tr{'pakfire possible dependency'}
110 $_ =~ s/\\e\[[0-1]\;[0-9]+m//g;
115 <tr><td colspan='2'>$Lang::tr{'pakfire accept all'}
116 <tr><td colspan='2'>
117 <tr><td align='right'><form method='post' action='$ENV{'SCRIPT_NAME'}'>
118 <input type='hidden' name='DELPAKS' value='$pakfiresettings{'DELPAKS'}' />
119 <input type='hidden' name='FORCE' value='on' />
120 <input type='hidden' name='ACTION' value='remove' />
121 <input type='image' alt='$Lang::tr{'uninstall'}' title='$Lang::tr{'uninstall'}' src='/images/go-next.png' />
124 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
125 <input type='hidden' name='ACTION' value='' />
126 <input type='image' alt='$Lang::tr{'abort'}' title='$Lang::tr{'abort'}' src='/images/dialog-error.png' />
131 &Header
::closebigbox
();
132 &Header
::closepage
();
136 } elsif ($pakfiresettings{'ACTION'} eq 'update') {
138 system("/usr/local/bin/pakfire update --force --no-colors &>/dev/null &");
139 system("/bin/sleep 1");
140 } elsif ($pakfiresettings{'ACTION'} eq 'upgrade') {
141 my $command = "/usr/local/bin/pakfire upgrade -y --no-colors &>/dev/null &";
143 system("/bin/sleep 1");
144 } elsif ($pakfiresettings{'ACTION'} eq "$Lang::tr{'save'}") {
145 &General
::writehash
("${General::swroot}/pakfire/settings", \
%pakfiresettings);
148 &General
::readhash
("${General::swroot}/pakfire/settings", \
%pakfiresettings);
153 # DPC move error message to top so it is seen!
155 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
156 print "<font class='base'>$errormessage </font>\n";
160 my $return = `pidof pakfire`;
163 &Header
::openbox
( 'Waiting', 1, "<meta http-equiv='refresh' content='10;'>" );
167 <img src='/images/indicator.gif' alt='$Lang::tr{'aktiv'}' title='$Lang::tr{'aktiv'}' />
169 $Lang::tr{'pakfire working'}
170 <tr><td colspan='2' align='center'>
171 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
172 <input type='image' alt='$Lang::tr{'reload'}' title='$Lang::tr{'reload'}' src='/images/view-refresh.png' />
174 <tr><td colspan='2' align='left'><code>
176 my @output = `grep pakfire /var/log/messages | tail -20`;
185 &Header
::closebigbox
();
186 &Header
::closepage
();
191 my $core_release = `cat /opt/pakfire/db/core/mine 2>/dev/null`;
192 chomp($core_release);
193 my $core_update_age = &General
::age
("/opt/pakfire/db/core/mine");
194 my $corelist_update_age = &General
::age
("/opt/pakfire/db/lists/core-list.db");
195 my $server_update_age = &General
::age
("/opt/pakfire/db/lists/server-list.db");
196 my $packages_update_age = &General
::age
("/opt/pakfire/db/lists/packages_list.db");
198 &Header
::openbox
("100%", "center", "Pakfire");
201 <table width='95%' cellpadding='5' >
203 if ( -e
"/var/run/need_reboot") {
204 print "<tr><td align='center' colspan='2'><font color='red'>$Lang::tr{'needreboot'}!</font></td></tr>";
205 print "<tr><td colspan='2'> </font></td></tr>"
208 <tr><td width="50%" bgcolor='$color{'color20'}' align="center"><b>$Lang::tr{'pakfire system state'}:</b>
210 <tr><td align="center">$Lang::tr{'pakfire core update level'}: $core_release<hr />
211 $Lang::tr{'pakfire last update'} $core_update_age $Lang::tr{'pakfire ago'}<br />
212 $Lang::tr{'pakfire last serverlist update'} $server_update_age $Lang::tr{'pakfire ago'}<br />
213 $Lang::tr{'pakfire last core list update'} $corelist_update_age $Lang::tr{'pakfire ago'}<br />
214 $Lang::tr{'pakfire last package update'} $packages_update_age $Lang::tr{'pakfire ago'}
215 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
216 <input type='hidden' name='ACTION' value='update' />
217 <input type='submit' value='$Lang::tr{'calamaris refresh list'}' /><br />
220 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
221 <select name="UPDPAKS" size="5" disabled>
223 &Pakfire
::dblist
("upgrade", "forweb");
227 <input type='hidden' name='ACTION' value='upgrade' />
228 <input type='image' alt='$Lang::tr{'upgrade'}' title='$Lang::tr{'upgrade'}' src='/images/document-save.png' />
231 <tr><td colspan="2"><!-- Just an empty line -->
232 <tr><td bgcolor='$color{'color20'}' align="center"><b>$Lang::tr{'pakfire available addons'}</b>
233 <td bgcolor='$color{'color20'}' align="center"><b>$Lang::tr{'pakfire installed addons'}</b>
234 <tr><td align="center">
235 <p>$Lang::tr{'pakfire install description'}</p>
236 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
237 <select name="INSPAKS" size="10" multiple>
239 &Pakfire
::dblist
("notinstalled", "forweb");
244 <input type='hidden' name='ACTION' value='install' />
245 <input type='image' alt='$Lang::tr{'install'}' title='$Lang::tr{'install'}' src='/images/list-add.png' />
249 <p>$Lang::tr{'pakfire uninstall description'}</p>
250 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
251 <select name="DELPAKS" size="10" multiple>
254 &Pakfire
::dblist
("installed", "forweb");
259 <input type='hidden' name='ACTION' value='remove' />
260 <input type='image' alt='$Lang::tr{'remove'}' title='$Lang::tr{'remove'}' src='/images/list-remove.png' />
266 &Header
::closebigbox
();
267 &Header
::closepage
();