X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fpakfire.cgi;h=8f20d57767293835e1a036e177784ef73c016ed5;hp=ca34292fec2d7c3f88c3d23ea8ad349a11f9ec44;hb=19b01b74f9b9e7cb01943f6c118b45d1eced9b4c;hpb=70db86838b15e991225ae29ff6ce9d521d5c4023 diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi index ca34292fec..8f20d57767 100644 --- a/html/cgi-bin/pakfire.cgi +++ b/html/cgi-bin/pakfire.cgi @@ -1,12 +1,23 @@ #!/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 . # +# # +############################################################################### use strict; @@ -32,9 +43,14 @@ $pakfiresettings{'VALID'} = ''; $pakfiresettings{'INSPAKS'} = ''; $pakfiresettings{'DELPAKS'} = ''; $pakfiresettings{'AUTOUPDATE'} = 'off'; +$pakfiresettings{'AUTOUPGRADE'} = 'off'; +$pakfiresettings{'HEALTHCHECK'} = 'on'; $pakfiresettings{'UUID'} = 'on'; +sub refreshpage{&Header::openbox( 'Waiting', 1, "" );print "

$Lang::tr{'pagerefresh'}
";&Header::closebox();} + &Header::getcgihash(\%pakfiresettings); + &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); @@ -46,15 +62,15 @@ if ($pakfiresettings{'ACTION'} eq 'install'){ if ("$pakfiresettings{'FORCE'}" eq "on") { my $command = "/usr/local/bin/pakfire install --non-interactive --no-colors $pakfiresettings{'INSPAKS'} &>/dev/null &"; system("$command"); - sleep(2); } else { &Header::openbox("100%", "center", "Abfrage"); my @output = `/usr/local/bin/pakfire resolvedeps --no-colors $pakfiresettings{'INSPAKS'}`; print <$Lang::tr{'pakfire install package'}.$pakfiresettings{'INSPAKS'}.$Lang::tr{'pakfire possible dependency'} -
		
+		
 END
 		foreach (@output) {
+		  $_ =~ s/\\[[0-1]\;[0-9]+m//g;
 			print "$_\n";
 		}
 		print <$Lang::tr{'pakfire uninstall package'}.$pakfiresettings{'DELPAKS'}.$Lang::tr{'pakfire possible dependency'}
-		
		
+		
 END
 		foreach (@output) {
+		  $_ =~ s/\\[[0-1]\;[0-9]+m//g;
 			print "$_\n";
 		}
 		print </dev/null &");
 
 } elsif ($pakfiresettings{'ACTION'} eq 'upgrade') {
-	
-	system("/usr/local/bin/pakfire upgrade -y --no-colors");
-	
+	my $command = "/usr/local/bin/pakfire upgrade -y --no-colors &>/dev/null &";
+	system("$command");
 } elsif ($pakfiresettings{'ACTION'} eq "$Lang::tr{'save'}") {
 
-	&General::writehash("${General::swroot}/pakfire/settings", \%pakfiresettings);
+	if ($pakfiresettings{'AUTOUPDATE'} eq 'on') {
+		system("/usr/local/bin/pakfire enable updates >/dev/null 2>&1");
+	} else {
+		system("/usr/local/bin/pakfire disable updates  >/dev/null 2>&1");
+	}
 
+	if ($pakfiresettings{'AUTOUPGRADE'} eq 'on') {
+		system("/usr/local/bin/pakfire enable upgrades >/dev/null 2>&1");
+	} else {
+		system("/usr/local/bin/pakfire disable upgrades >/dev/null 2>&1");
+	}
+
+	&General::writehash("${General::swroot}/pakfire/settings", \%pakfiresettings);
 }
 
 &General::readhash("${General::swroot}/pakfire/settings", \%pakfiresettings);
@@ -141,6 +167,12 @@ my %checked=();
 $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{'HEALTHCHECK'}{'off'} = '';
+$checked{'HEALTHCHECK'}{'on'} = '';
+$checked{'HEALTHCHECK'}{$pakfiresettings{'HEALTHCHECK'}} = "checked='checked'";
 $checked{'UUID'}{'off'} = '';
 $checked{'UUID'}{'on'} = '';
 $checked{'UUID'}{$pakfiresettings{'UUID'}} = "checked='checked'";
@@ -155,7 +187,7 @@ if ($errormessage) {
 my $return = `pidof pakfire`;
 chomp($return);
 if ($return) {
-	&Header::openbox( 'Waiting', 1, "" );
+	&Header::openbox( 'Waiting', 1, "" );
 	print <
 		
@@ -168,7 +200,7 @@ if ($return) {
 			
 		
 END
-	my @output = `tail -20 /var/log/pakfire.log`;
+	my @output = `grep pakfire /var/log/messages | tail -20`;
 	foreach (@output) {
 		print "$_";
 	}
@@ -180,71 +212,97 @@ END
 	&Header::closebigbox();
 	&Header::closepage();
 	exit;
+	refreshpage();
 }
 
-&Header::openbox("100%", "center", "Pakfire");
+my $core_release = `cat /opt/pakfire/db/core/mine 2>/dev/null`;
+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 <
-		$Lang::tr{'pakfire available addons'}$Lang::tr{'pakfire installed addons'}
-		
+	
+		
-		
-		
$Lang::tr{'pakfire system state'}: + +
$Lang::tr{'pakfire core update level'}: $core_release
+ $Lang::tr{'pakfire last update'} $core_update_age ago
+ $Lang::tr{'pakfire last serverlist update'} $server_update_age ago
+ $Lang::tr{'pakfire last core list update'} $corelist_update_age ago
+ $Lang::tr{'pakfire last package update'} $packages_update_age ago +
+ +
+
+
+
+ + +
+ +
  +
$Lang::tr{'pakfire available addons'} + $Lang::tr{'pakfire installed addons'} +
+

$Lang::tr{'pakfire install description'}

+
-
- -
- -
- -
- - -
+ + +

$Lang::tr{'pakfire uninstall description'}

+
-
-
- -
$Lang::tr{'pakfire updates'}
-
  - +
+ + + +
END - &Pakfire::dblist("upgrade", "forweb"); +&Header::closebox(); +&Header::openbox("100%", "center", "$Lang::tr{'settings'}"); print < - - - -
- -
$Lang::tr{'basic options'}
-
$Lang::tr{'pakfire update daily'} - - $Lang::tr{'pakfire register'} - -
+ + + + + + +
$Lang::tr{'basic options'}
$Lang::tr{'pakfire update daily'} + on | + off
$Lang::tr{'pakfire core update auto'} + on | + off
$Lang::tr{'pakfire health check'} + on | + off
$Lang::tr{'pakfire register'} + on | + off
END