X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fpakfire.cgi;h=ca7a4ad4d918aa52f5f885edb91a5e85018b17e2;hp=21160620d4d4daa09ec3eaf1a2347ba0d6d18fb3;hb=25dea62ac0410f129840a752544040abd7182953;hpb=c5d106c11c617631543aa42196287e0d41aa3299 diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi index 21160620d4..ca7a4ad4d9 100644 --- a/html/cgi-bin/pakfire.cgi +++ b/html/cgi-bin/pakfire.cgi @@ -44,9 +44,13 @@ $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); @@ -58,15 +62,16 @@ 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); + system("/bin/sleep 1"); } 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");
 
+	system("/usr/local/bin/pakfire update --force --no-colors &>/dev/null &");
+	system("/bin/sleep 1");
 } elsif ($pakfiresettings{'ACTION'} eq 'upgrade') {
-	
-	system("/usr/local/bin/pakfire upgrade -y --no-colors &>/dev/null");
-	
+	my $command = "/usr/local/bin/pakfire upgrade -y --no-colors &>/dev/null &";
+	system("$command");
+	system("/bin/sleep 1");
 } elsif ($pakfiresettings{'ACTION'} eq "$Lang::tr{'save'}") {
 
-	if ($pakfiresettings{'AUTOUPDATE'} == "on") {
-		system("/usr/local/bin/pakfire enable updates");
+	if ($pakfiresettings{'AUTOUPDATE'} eq 'on') {
+		system("/usr/local/bin/pakfire enable updates >/dev/null 2>&1");
 	} else {
-		system("/usr/local/bin/pakfire disable updates");
+		system("/usr/local/bin/pakfire disable updates  >/dev/null 2>&1");
 	}
-	
-	if ($pakfiresettings{'AUTOUPGRADE'} == "on") {
-		system("/usr/local/bin/pakfire enable upgrades");
+
+	if ($pakfiresettings{'AUTOUPGRADE'} eq 'on') {
+		system("/usr/local/bin/pakfire enable upgrades >/dev/null 2>&1");
 	} else {
-		system("/usr/local/bin/pakfire disable upgrades");
+		system("/usr/local/bin/pakfire disable upgrades >/dev/null 2>&1");
 	}
 
 	&General::writehash("${General::swroot}/pakfire/settings", \%pakfiresettings);
@@ -167,6 +173,9 @@ $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'";
@@ -194,7 +203,7 @@ if ($return) {
 			
 		
 END
-	my @output = `tail -20 /var/log/pakfire.log`;
+	my @output = `grep pakfire /var/log/messages | tail -20`;
 	foreach (@output) {
 		print "$_";
 	}
@@ -206,9 +215,10 @@ END
 	&Header::closebigbox();
 	&Header::closepage();
 	exit;
+	refreshpage();
 }
 
-my $core_release = `cat /opt/pakfire/db/core/mine`;
+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");
@@ -218,7 +228,7 @@ my $packages_update_age = &General::age("/opt/pakfire/db/lists/packages_list.db"
 &Header::openbox("100%", "center", "Pakfire");
 
 print <
+	
$Lang::tr{'pakfire system state'}:
$Lang::tr{'pakfire core update level'}: $core_release
@@ -228,7 +238,7 @@ print < -
+
@@ -241,17 +251,17 @@ END
- +
 
$Lang::tr{'pakfire available addons'} $Lang::tr{'pakfire installed addons'}
-

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

-
+

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

+
-

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

+

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

-
$Lang::tr{'basic options'} -
$Lang::tr{'pakfire update daily'} - - $Lang::tr{'pakfire register'} - -
$Lang::tr{'pakfire core update auto'} - -   -
+ + + + + + +
$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