X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Fpakfire.cgi;h=21160620d4d4daa09ec3eaf1a2347ba0d6d18fb3;hb=70ccd4a7b550782fce2fd5ac7084d69a45a7720e;hp=c9d9db8ba0d78cd70ac05aff07f1252c4b9e1d33;hpb=908a3eb776d872efef8dbd674563a8f0ce45af1d;p=people%2Fpmueller%2Fipfire-2.x.git diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi index c9d9db8ba0..21160620d4 100644 --- a/html/cgi-bin/pakfire.cgi +++ b/html/cgi-bin/pakfire.cgi @@ -1,18 +1,29 @@ #!/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; # 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"; @@ -21,6 +32,8 @@ require "/opt/pakfire/lib/functions.pl"; my %pakfiresettings=(); my $errormessage = ''; +my %color = (); +my %mainsettings = (); &Header::showhttpheaders(); @@ -30,9 +43,12 @@ $pakfiresettings{'VALID'} = ''; $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); @@ -40,14 +56,14 @@ $pakfiresettings{'UUID'} = 'on'; if ($pakfiresettings{'ACTION'} eq 'install'){ $pakfiresettings{'INSPAKS'} =~ s/\|/\ /g; if ("$pakfiresettings{'FORCE'}" eq "on") { - my $command = "/usr/local/bin/pakfire install --non-interactive $pakfiresettings{'INSPAKS'} &>/dev/null &"; + 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 $pakfiresettings{'INSPAKS'}`; + my @output = `/usr/local/bin/pakfire resolvedeps --no-colors $pakfiresettings{'INSPAKS'}`; print <Sie maechten folgende Pakete installieren: "$pakfiresettings{'INSPAKS'}". Moeglicherweise haben diese Pakete Abhaengigkeiten, d.h. andere Pakete muessen zusaetzlich installiert werden. Dazu sehen sie unten eine Liste. +
$Lang::tr{'pakfire install package'}.$pakfiresettings{'INSPAKS'}.$Lang::tr{'pakfire possible dependency'}
		
 END
 		foreach (@output) {
@@ -55,7 +71,7 @@ END
 		}
 		print <
-		
Moechten Sie der Installation aller Pakete zustimmen? +
$Lang::tr{'pakfire accept all'}
 
@@ -77,18 +93,67 @@ END } } elsif ($pakfiresettings{'ACTION'} eq 'remove') { + $pakfiresettings{'DELPAKS'} =~ s/\|/\ /g; + if ("$pakfiresettings{'FORCE'}" eq "on") { + my $command = "/usr/local/bin/pakfire remove --non-interactive --no-colors $pakfiresettings{'DELPAKS'} &>/dev/null &"; + system("$command"); + sleep(2); + } else { + &Header::openbox("100%", "center", "Abfrage"); + my @output = `/usr/local/bin/pakfire resolvedeps --no-colors $pakfiresettings{'DELPAKS'}`; + print <
$Lang::tr{'pakfire uninstall package'}.$pakfiresettings{'DELPAKS'}.$Lang::tr{'pakfire possible dependency'} +
		
+END
+		foreach (@output) {
+			print "$_\n";
+		}
+		print <
+		
$Lang::tr{'pakfire accept all'} +
  +
+ + + + + + +
+ + +
+
+END + &Header::closebox(); + &Header::closebigbox(); + &Header::closepage(); + exit; + } + } elsif ($pakfiresettings{'ACTION'} eq 'update') { - system("/usr/local/bin/pakfire update --force"); + system("/usr/local/bin/pakfire update --force --no-colors &>/dev/null"); } elsif ($pakfiresettings{'ACTION'} eq 'upgrade') { - system("/usr/local/bin/pakfire upgrade -y"); + 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); @@ -99,6 +164,9 @@ 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{'UUID'}{'off'} = ''; $checked{'UUID'}{'on'} = ''; $checked{'UUID'}{$pakfiresettings{'UUID'}} = "checked='checked'"; @@ -113,96 +181,116 @@ if ($errormessage) { my $return = `pidof pakfire`; chomp($return); if ($return) { - &Header::openbox("100%", "center", "Aktiv"); + &Header::openbox( 'Waiting', 1, "" ); print < $Lang::tr{  - Pakfire fuehrt gerade eine Aufgabe aus... Bitte warten sie, bis diese erfolgreich beendet wurde. + $Lang::tr{'pakfire working'}
- ### TO BE CONTINUED.... WE HAVE TO BEAUTIFY THIS A LITTLE BIT :D
 END
-my @output = `tail /var/log/messages | grep pakfire`;
-foreach (@output) {
-	print "$_";
-}
-print <
-	
+	my @output = `tail -20 /var/log/pakfire.log`;
+	foreach (@output) {
+		print "$_";
+	}
+	print <
+		
 END
-  	### TO BE CONTINUED.... WE HAVE TO BEAUTIFY THIS A LITTLE BIT :D
 	&Header::closebox();
 	&Header::closebigbox();
 	&Header::closepage();
 	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 <
-		Verfuegbare 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'}

+
+
-
- -
- -
- -
- - -
Installierte Addons:
+ +
+

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

+
-


-
- -
Zur Verfuegung stehende Updates: -
  - +
+ + + +
END - &Pakfire::dblist("upgrade", "forweb"); +&Header::closebox(); +&Header::openbox("100%", "center", "$Lang::tr{'settings'}"); print < - - - -


-
Automatische Updates taeglich ausfuehren: +
$Lang::tr{'basic options'} +
$Lang::tr{'pakfire update daily'} - Registrierung am Master-Server: + $Lang::tr{'pakfire register'} -
+
$Lang::tr{'pakfire core update auto'} + +   +
END