#!/usr/bin/perl
-#
-# IPFire CGIs
-#
-# This file is part of the IPFire Project
-#
-# This code is distributed under the terms of the GPL
-#
-#
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
use strict;
# enable only the following on debugging purpose
-use warnings;
-use CGI::Carp 'fatalsToBrowser';
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
my %pakfiresettings=();
my $errormessage = '';
+my %color = ();
+my %mainsettings = ();
&Header::showhttpheaders();
$pakfiresettings{'INSPAKS'} = '';
$pakfiresettings{'DELPAKS'} = '';
$pakfiresettings{'AUTOUPDATE'} = 'off';
+$pakfiresettings{'AUTOUPGRADE'} = 'off';
$pakfiresettings{'UUID'} = 'on';
&Header::getcgihash(\%pakfiresettings);
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
&Header::openpage($Lang::tr{'pakfire configuration'}, 1);
&Header::openbigbox('100%', 'left', '', $errormessage);
} elsif ($pakfiresettings{'ACTION'} eq 'update') {
- system("/usr/local/bin/pakfire update --force --no-colors");
+ system("/usr/local/bin/pakfire update --force --no-colors &>/dev/null");
} elsif ($pakfiresettings{'ACTION'} eq 'upgrade') {
- system("/usr/local/bin/pakfire upgrade -y --no-colors");
+ system("/usr/local/bin/pakfire upgrade -y --no-colors &>/dev/null");
} elsif ($pakfiresettings{'ACTION'} eq "$Lang::tr{'save'}") {
- &General::writehash("${General::swroot}/pakfire/settings", \%pakfiresettings);
+ if ($pakfiresettings{'AUTOUPDATE'} == "on") {
+ system("/usr/local/bin/pakfire enable updates");
+ } else {
+ system("/usr/local/bin/pakfire disable updates");
+ }
+
+ if ($pakfiresettings{'AUTOUPGRADE'} == "on") {
+ system("/usr/local/bin/pakfire enable upgrades");
+ } else {
+ system("/usr/local/bin/pakfire disable upgrades");
+ }
+ &General::writehash("${General::swroot}/pakfire/settings", \%pakfiresettings);
}
&General::readhash("${General::swroot}/pakfire/settings", \%pakfiresettings);
$checked{'AUTOUPDATE'}{'off'} = '';
$checked{'AUTOUPDATE'}{'on'} = '';
$checked{'AUTOUPDATE'}{$pakfiresettings{'AUTOUPDATE'}} = "checked='checked'";
+$checked{'AUTOUPGRADE'}{'off'} = '';
+$checked{'AUTOUPGRADE'}{'on'} = '';
+$checked{'AUTOUPGRADE'}{$pakfiresettings{'AUTOUPGRADE'}} = "checked='checked'";
$checked{'UUID'}{'off'} = '';
$checked{'UUID'}{'on'} = '';
$checked{'UUID'}{$pakfiresettings{'UUID'}} = "checked='checked'";
my $return = `pidof pakfire`;
chomp($return);
if ($return) {
- &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='5;'>" );
+ &Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='10;'>" );
print <<END;
<table>
<tr><td>
exit;
}
-&Header::openbox("100%", "center", "Pakfire");
+my $core_release = `cat /opt/pakfire/db/core/mine`;
+chomp($core_release);
+my $core_update_age = &General::age("/opt/pakfire/db/core/mine");
+my $corelist_update_age = &General::age("/opt/pakfire/db/lists/core-list.db");
+my $server_update_age = &General::age("/opt/pakfire/db/lists/server-list.db");
+my $packages_update_age = &General::age("/opt/pakfire/db/lists/packages_list.db");
-system("pakfire update &>dev/null");
+&Header::openbox("100%", "center", "Pakfire");
print <<END;
- <table width='100%'>
- <tr><td width='40%' align="center">Verfuegbare Addons:<br />
- <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <table width='100%' cellpadding='5' >
+ <tr><td width="50%" bgcolor='$color{'color20'}' align="center"><b>$Lang::tr{'pakfire system state'}:</b>
+ <td width="50%">
+ <tr><td align="center">$Lang::tr{'pakfire core update level'}: $core_release<hr />
+ $Lang::tr{'pakfire last update'} $core_update_age ago<br />
+ $Lang::tr{'pakfire last serverlist update'} $server_update_age ago<br />
+ $Lang::tr{'pakfire last core list update'} $corelist_update_age ago<br />
+ $Lang::tr{'pakfire last package update'} $packages_update_age ago
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <input type='hidden' name='ACTION' value='update' />
+ <input type='submit' value='Liste aktualisieren' /><br />
+ </form>
+ <td align="center">
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+ <select name="UPDPAKS" size="5" disabled>
+END
+ &Pakfire::dblist("upgrade", "forweb");
+ print <<END;
+ </select>
+ <br />
+ <input type='hidden' name='ACTION' value='upgrade' />
+ <input type='image' alt='$Lang::tr{'upgrade'}' src='/images/document-save.png' />
+ </form>
+
+ <tr><td colspan="2"><!-- Just an empty line -->
+ <tr><td bgcolor='$color{'color20'}' align="center"><b>$Lang::tr{'pakfire available addons'}</b>
+ <td bgcolor='$color{'color20'}' align="center"><b>$Lang::tr{'pakfire installed addons'}</b>
+ <tr><td align="center">
+ <p>$Lang::tr{'pakfire install description'}</p>
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<select name="INSPAKS" size="10" multiple>
END
&Pakfire::dblist("notinstalled", "forweb");
print <<END;
</select>
- </td>
- <td width='20%' align="center">
+ <br />
<input type='hidden' name='ACTION' value='install' />
<input type='image' alt='$Lang::tr{'install'}' src='/images/list-add.png' />
- </form><br />
-
- <form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='update' />
- <input type='submit' value='Liste aktualisieren' /><br />
</form>
-
- <form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <input type='hidden' name='ACTION' value='remove' />
- <input type='image' alt='$Lang::tr{'remove'}' src='/images/list-remove.png' />
- </td>
- <td width='40%' align="center">$Lang::tr{'pakfire installed addons'}<br />
+
+ <td align="center">
+ <p>$Lang::tr{'pakfire uninstall description'}</p>
+ <form method='post' action='$ENV{'SCRIPT_NAME'}'>
<select name="DELPAKS" size="10" multiple>
END
&Pakfire::dblist("installed", "forweb");
print <<END;
- </select>
- </table></form>
- <br /><hr /><br />
- <form method='post' action='$ENV{'SCRIPT_NAME'}'>
- <table width='100%'>
- <tr><td colspan='2'>$Lang::tr{'pakfire updates'}
- <tr><td width='20%'> <td width='60%' align='center'>
- <select name="UPDPAKS" size="5" disabled>
+ </select>
+ <br />
+ <input type='hidden' name='ACTION' value='remove' />
+ <input type='image' alt='$Lang::tr{'remove'}' src='/images/list-remove.png' />
+ </form>
+ </table>
END
- &Pakfire::dblist("upgrade", "forweb");
+&Header::closebox();
+&Header::openbox("100%", "center", "$Lang::tr{'settings'}");
print <<END;
- </select>
- <td width='20%' align='center' valign='middle'><input type='hidden' name='ACTION' value='upgrade' />
- <input type='image' alt='$Lang::tr{'upgrade'}' src='/images/document-save.png' />
- </table></form>
- <br /><hr /><br />
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='100%'>
+ <tr><td colspan='4' bgcolor='$color{'color20'}'><b>$Lang::tr{'basic options'}</b>
<tr><td width='40%' align="right">$Lang::tr{'pakfire update daily'}
<td width='10%' align="left"><input type="checkbox" name="AUTOUPDATE" $checked{'AUTOUPDATE'}{'on'} />
<td width='40%' align="right">$Lang::tr{'pakfire register'}
<td width='10%' align="left"><input type="checkbox" name="UUID" $checked{'UUID'}{'on'} />
- <tr><td width='100%' colspan="4" align="right"><input type="submit" name="ACTION" value="$Lang::tr{'save'}" />
+ <tr><td width='40%' align="right">$Lang::tr{'pakfire core update auto'}
+ <td width='10%' align="left"><input type="checkbox" name="AUTOUPGRADE" $checked{'AUTOUPGRADE'}{'on'} />
+ <td width='50%' colspan="2">
+ <tr><td width='100%' colspan="4" align="center"><input type="submit" name="ACTION" value="$Lang::tr{'save'}" />
</table>
</form>
END