From: ms Date: Wed, 29 Aug 2007 10:14:06 +0000 (+0000) Subject: Pakfire laedt die Listen jetzt besser und hat eine veraenderte Oberflaeche bekommen. X-Git-Tag: v2.3-beta1~420 X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff_plain;h=377560fbff99600f9260764b8c16e8a02821ea3a;ds=sidebyside Pakfire laedt die Listen jetzt besser und hat eine veraenderte Oberflaeche bekommen. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@852 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi index d62be482f4..99f28baa76 100644 --- a/html/cgi-bin/pakfire.cgi +++ b/html/cgi-bin/pakfire.cgi @@ -32,10 +32,9 @@ $pakfiresettings{'VALID'} = ''; $pakfiresettings{'INSPAKS'} = ''; $pakfiresettings{'DELPAKS'} = ''; $pakfiresettings{'AUTOUPDATE'} = 'off'; +$pakfiresettings{'AUTOUPGRADE'} = 'off'; $pakfiresettings{'UUID'} = 'on'; -system("/usr/local/bin/pakfire update >/dev/null") if not -e "/opt/pakfire/db/lists/packages_list.db"; - &Header::getcgihash(\%pakfiresettings); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); @@ -123,16 +122,27 @@ END } 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); @@ -143,6 +153,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'"; @@ -184,66 +197,88 @@ END exit; } +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"); + &Header::openbox("100%", "center", "Pakfire"); print < - $Lang::tr{'pakfire available addons'}$Lang::tr{'pakfire installed addons'} - -
+ + - -
(TR) Your system's state: + +
(TR) Core-Update-Level: $core_release
+ (TR) Last Update made $core_update_age ago
+ (TR) Last server list update made $server_update_age ago
+ (TR) Last core list update made $corelist_update_age ago
+ (TR) Last packages list update made $packages_update_age ago + + +
+ +
+
+ + +
+ +
  +
$Lang::tr{'pakfire available addons'} + $Lang::tr{'pakfire installed addons'} +
+

(TR) Please choose one or more items from the list below and click the 'plus' to install.

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

(TR) Please choose one or more items from the list below and click the 'minus' to uninstall.

+
-
-
- -
$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{'basic options'}
$Lang::tr{'pakfire update daily'} $Lang::tr{'pakfire register'} +
(TR) Apply core updates automatically? + +  
diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl index 8544e054f1..60784b4e81 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -111,11 +111,13 @@ sub pinghost { sub fetchfile { my $getfile = shift; my $gethost = shift; - my (@server, $host, $proto, $file, $allok, $i); + my (@server, $host, $proto, $file, $i); + my $allok = 0; - logger("DOWNLOAD STARTED: $getfile") unless ($bfile =~ /^counter\?.*/); use File::Basename; $bfile = basename("$getfile"); + + logger("DOWNLOAD STARTED: $getfile") unless ($bfile =~ /^counter\?.*/); $i = 0; while (($allok == 0) && $i < 5) { @@ -210,40 +212,46 @@ sub fetchfile { } sub getmirrors { + my $force = shift; + my $age; + use File::Copy; - - logger("MIRROR: Trying to get a mirror list."); if ( -e "$Conf::dbdir/lists/server-list.db" ) { my @stat = stat("$Conf::dbdir/lists/server-list.db"); my $time = time(); $age = $time - $stat[9]; + $force = "force" if ("$age" >= "3600"); + logger("MIRROR INFO: server-list.db is $age seconds old. - DEBUG: $force"); } else { # Force an update. - $age = "86401"; + $force = "force"; } - if ("$age" gt "86400") { + if ("$force" eq "force") { fetchfile("$Conf::version/lists/server-list.db", "$Conf::mainserver"); move("$Conf::cachedir/server-list.db", "$Conf::dbdir/lists/server-list.db"); } } sub getcoredb { + my $force = shift; + my $age; + use File::Copy; - - logger("CORE: Trying to get a core list."); if ( -e "$Conf::dbdir/lists/core-list.db" ) { my @stat = stat("$Conf::dbdir/lists/core-list.db"); my $time = time(); $age = $time - $stat[9]; + $force = "force" if ("$age" >= "3600"); + logger("CORE INFO: core-list.db is $age seconds old. - DEBUG: $force"); } else { # Force an update. - $age = "3601"; + $force = "force"; } - if ("$age" gt "3600") { + if ("$force" eq "force") { fetchfile("lists/core-list.db", ""); move("$Conf::cachedir/core-list.db", "$Conf::dbdir/lists/core-list.db"); } @@ -256,7 +264,7 @@ sub selectmirror { my $count = 0; while (!(open(FILE, "<$Conf::dbdir/lists/server-list.db")) && ($count lt 5)) { $count++; - getmirrors(); + getmirrors("noforce"); } if ($count == 5) { message("MIRROR ERROR: Could not find or download a server list"); @@ -315,12 +323,14 @@ sub dbgetlist { my @stat = stat("$Conf::dbdir/lists/packages_list.db"); my $time = time(); $age = $time - $stat[9]; + $force = "force" if ("$age" >= "3600"); + logger("DB INFO: packages_list.db is $age seconds old. - DEBUG: $force"); } else { # Force an update. - $age = "3601"; + $force = "force"; } - if (("$age" gt "3600") || ("$force" eq "force")) { + if ("$force" eq "force") { fetchfile("lists/packages_list.db", ""); move("$Conf::cachedir/packages_list.db", "$Conf::dbdir/lists/packages_list.db"); } @@ -342,14 +352,14 @@ sub dblist { my @templine; ### Make sure that the list is not outdated. - dbgetlist("noforce"); + #dbgetlist("noforce"); open(FILE, "<$Conf::dbdir/lists/packages_list.db"); my @db = ; close(FILE); if ("$filter" eq "upgrade") { - getcoredb(); + getcoredb("noforce"); eval(`grep "core_" $Conf::dbdir/lists/core-list.db`); if ("$core_release" gt "$Conf::core_mine") { if ("$forweb" eq "forweb") { @@ -631,7 +641,7 @@ sub setuppak { } sub upgradecore { - getcoredb(); + getcoredb("noforce"); eval(`grep "core_" $Conf::dbdir/lists/core-list.db`); if ("$core_release" gt "$Conf::core_mine") { message("CORE UPGR: Upgrading from release $Conf::core_mine to $core_release"); diff --git a/src/pakfire/pakfire b/src/pakfire/pakfire index d262ac3843..9768836ea5 100644 --- a/src/pakfire/pakfire +++ b/src/pakfire/pakfire @@ -3,6 +3,7 @@ require "/opt/pakfire/lib/functions.pl"; my $interactive = 1; + my $force = "noforce"; &Pakfire::logger("PAKFIRE INFO: IPFire Pakfire $Conf::version started!"); &Pakfire::checkcryptodb; @@ -45,6 +46,10 @@ # Turn off shell colors - Bad for displaying in webinterface $Pakfire::enable_colors = 0 if ("$_" eq "--no-colors"); + + # Turn on force mode + $force = "force" if ("$_" eq "-f" ); + $force = "force" if ("$_" eq "--force" ); } } @@ -207,9 +212,9 @@ } elsif ("$ARGV[0]" eq "update") { &Pakfire::makeuuid(); &Pakfire::senduuid(); - &Pakfire::getmirrors(); - &Pakfire::dbgetlist("noforce"); - &Pakfire::getcoredb(); + &Pakfire::getmirrors("$force"); + &Pakfire::dbgetlist("$force"); + &Pakfire::getcoredb("$force"); } elsif ("$ARGV[0]" eq "upgrade") { &Pakfire::upgradecore(); @@ -259,6 +264,18 @@ next if ("$_" =~ "^-"); &Pakfire::resolvedeps("$_"); } + } elsif ("$ARGV[0]" eq "enable") { + if ("$ARGV[1]" eq "updates") { + system("ln -s ../../opt/pakfire/pakfire /etc/fcron.daily/pakfire-update"); + elsif ("$ARGV[1]" eq "upgrades") { + system("ln -s ../../opt/pakfire/pakfire /etc/fcron.daily/pakfire-upgrade"); + } + } elsif ("$ARGV[0]" eq "disable") { + if ("$ARGV[1]" eq "updates") { + system("rm -f /etc/fcron.daily/pakfire-update"); + elsif ("$ARGV[1]" eq "upgrades") { + system("rm -f /etc/fcron.daily/pakfire-upgrade"); + } } else { &Pakfire::usage; } diff --git a/src/patches/openswan-2.4.9-realsetup-1.patch b/src/patches/openswan-2.4.9-realsetup-1.patch index a5e6314c2f..30616c3a4b 100644 --- a/src/patches/openswan-2.4.9-realsetup-1.patch +++ b/src/patches/openswan-2.4.9-realsetup-1.patch @@ -1,5 +1,5 @@ ---- programs/_realsetup/_realsetup.in -+++ programs/_realsetup/_realsetup.in +--- _realsetup ++++ _realsetup @@ -193,8 +193,8 @@ # preliminaries