Pakfire laedt die Listen jetzt besser und hat eine veraenderte Oberflaeche bekommen.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Wed, 29 Aug 2007 10:14:06 +0000 (10:14 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Wed, 29 Aug 2007 10:14:06 +0000 (10:14 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@852 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

html/cgi-bin/pakfire.cgi
src/pakfire/lib/functions.pl
src/pakfire/pakfire
src/patches/openswan-2.4.9-realsetup-1.patch

index d62be48..99f28ba 100644 (file)
@@ -32,10 +32,9 @@ $pakfiresettings{'VALID'} = '';
 $pakfiresettings{'INSPAKS'} = '';
 $pakfiresettings{'DELPAKS'} = '';
 $pakfiresettings{'AUTOUPDATE'} = 'off';
 $pakfiresettings{'INSPAKS'} = '';
 $pakfiresettings{'DELPAKS'} = '';
 $pakfiresettings{'AUTOUPDATE'} = 'off';
+$pakfiresettings{'AUTOUPGRADE'} = 'off';
 $pakfiresettings{'UUID'} = 'on';
 
 $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);
 &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') {
        
 
 } 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') {
        
 
 } 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'}") {
 
        
 } 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);
 }
 
 &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{'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'";
 $checked{'UUID'}{'off'} = '';
 $checked{'UUID'}{'on'} = '';
 $checked{'UUID'}{$pakfiresettings{'UUID'}} = "checked='checked'";
@@ -184,66 +197,88 @@ END
        exit;
 }
 
        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 <<END;
 &Header::openbox("100%", "center", "Pakfire");
 
 print <<END;
-       <table width='100%'>
-               <tr><td bgcolor='$color{'color20'}' align="center"><b>$Lang::tr{'pakfire available addons'}</b></td><td bgcolor='$color{'color20'}'></td><td bgcolor='$color{'color20'}' align="center"><b>$Lang::tr{'pakfire installed addons'}</b>
-               <tr><td width='40%' align="center">
-                       <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+       <table width='100%' cellpadding='5' >
+               <tr><td width="50%" bgcolor='$color{'color20'}' align="center"><b>(TR) Your system's state:</b>
+                               <td width="50%">
+               <tr><td align="center">(TR) Core-Update-Level: $core_release<hr />
+                                       (TR) Last Update made $core_update_age ago<br />
+                                       (TR) Last server list update made $server_update_age ago<br />
+                                       (TR) Last core list update made $corelist_update_age ago<br />
+                                       (TR) Last packages list update made $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 -->&nbsp;
+               <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>(TR) Please choose one or more items from the list below and click the 'plus' to install.</p>
+                       <form method='post' action='$ENV{'SCRIPT_NAME'}'>       
                                <select name="INSPAKS" size="10" multiple>
 END
                        &Pakfire::dblist("notinstalled", "forweb");
                
 print <<END;
                                </select>
                                <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' />
                                <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>
-                       
-                       <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">
+
+               <td align="center">
+                       <p>(TR) Please choose one or more items from the list below and click the 'minus' to uninstall.</p>
+                <form method='post' action='$ENV{'SCRIPT_NAME'}'>
                        <select name="DELPAKS" size="10" multiple>
 END
 
                        &Pakfire::dblist("installed", "forweb");
 
 print <<END;
                        <select name="DELPAKS" size="10" multiple>
 END
 
                        &Pakfire::dblist("installed", "forweb");
 
 print <<END;
-               </select>
-       </table></form>
-       <br />
-       <form method='post' action='$ENV{'SCRIPT_NAME'}'>
-       <table width='100%'>
-               <tr><td colspan='3' bgcolor='$color{'color20'}'><b>$Lang::tr{'pakfire updates'}</b></br>
-               <tr><td width='20%'>&nbsp;<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
 
 END
 
-                       &Pakfire::dblist("upgrade", "forweb");
+&Header::closebox();
+&Header::openbox("100%", "center", "$Lang::tr{'settings'}");
 
 print <<END;
 
 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 />
        <form method='post' action='$ENV{'SCRIPT_NAME'}'>
                <table width='100%'>
        <form method='post' action='$ENV{'SCRIPT_NAME'}'>
                <table width='100%'>
-                       <tr><td colspan='4' bgcolor='$color{'color20'}'><b>$Lang::tr{'basic options'}</b></br>
+                       <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='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='40%' align="right">(TR) Apply core updates automatically?
+                                       <td width='10%' align="left"><input type="checkbox" name="AUTOUPGRADE" $checked{'AUTOUPGRADE'}{'on'} />
+                                       <td width='50%' colspan="2">&nbsp;
                        <tr><td width='100%' colspan="4" align="center"><input type="submit" name="ACTION" value="$Lang::tr{'save'}" />
                </table>
        </form>
                        <tr><td width='100%' colspan="4" align="center"><input type="submit" name="ACTION" value="$Lang::tr{'save'}" />
                </table>
        </form>
index 8544e05..60784b4 100644 (file)
@@ -111,11 +111,13 @@ sub pinghost {
 sub fetchfile {
        my $getfile = shift;
        my $gethost = shift;
 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");
        use File::Basename;
        $bfile = basename("$getfile");
+       
+       logger("DOWNLOAD STARTED: $getfile") unless ($bfile =~ /^counter\?.*/);
 
        $i = 0; 
        while (($allok == 0) && $i < 5) {
 
        $i = 0; 
        while (($allok == 0) && $i < 5) {
@@ -210,40 +212,46 @@ sub fetchfile {
 }
 
 sub getmirrors {
 }
 
 sub getmirrors {
+       my $force = shift;
+       my $age;
+       
        use File::Copy;
        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];
        
        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.
        } 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 {
                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;
        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];
        
        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.
        } 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");
        }
                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++;
        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");
        }
        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];
                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.
        } 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");
        }
                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. 
        my @templine;
        
        ### Make sure that the list is not outdated. 
-       dbgetlist("noforce");
+       #dbgetlist("noforce");
 
        open(FILE, "<$Conf::dbdir/lists/packages_list.db");
        my @db = <FILE>;
        close(FILE);
 
        if ("$filter" eq "upgrade") {
 
        open(FILE, "<$Conf::dbdir/lists/packages_list.db");
        my @db = <FILE>;
        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") {
                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 {
 }
 
 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");
        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");
index d262ac3..9768836 100644 (file)
@@ -3,6 +3,7 @@
        require "/opt/pakfire/lib/functions.pl";
        
        my $interactive = 1;
        require "/opt/pakfire/lib/functions.pl";
        
        my $interactive = 1;
+       my $force = "noforce";
        
        &Pakfire::logger("PAKFIRE INFO: IPFire Pakfire $Conf::version started!");
        &Pakfire::checkcryptodb;
        
        &Pakfire::logger("PAKFIRE INFO: IPFire Pakfire $Conf::version started!");
        &Pakfire::checkcryptodb;
                        
                        # Turn off shell colors - Bad for displaying in webinterface
                        $Pakfire::enable_colors = 0 if ("$_" eq "--no-colors");
                        
                        # 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" );
                }
        }
 
                }
        }
 
        } elsif ("$ARGV[0]" eq "update") {
                &Pakfire::makeuuid();
                &Pakfire::senduuid();
        } 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();
 
        } elsif ("$ARGV[0]" eq "upgrade") {
                &Pakfire::upgradecore();
                        next if ("$_" =~ "^-");
                        &Pakfire::resolvedeps("$_");
                }
                        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;
        }
        } else {
                &Pakfire::usage;
        }
index a5e6314..30616c3 100644 (file)
@@ -1,5 +1,5 @@
---- programs/_realsetup/_realsetup.in
-+++ programs/_realsetup/_realsetup.in
+--- _realsetup
++++ _realsetup
 @@ -193,8 +193,8 @@
  
        # preliminaries
 @@ -193,8 +193,8 @@
  
        # preliminaries