]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/pakfire/lib/functions.pl
pakfire: use correct tree on x86_64.
[ipfire-2.x.git] / src / pakfire / lib / functions.pl
index 8d4a7da7db52b5a47a617fb3819bbaf67453cf18..96f8d144a975c3b48f2c87c8948afd2ee7cebd38 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+# Copyright (C) 2007-2015   IPFire Team   <info@ipfire.org>                   #
 #                                                                             #
 # 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        #
@@ -116,7 +116,7 @@ sub usage {
 sub pinghost {
        my $host = shift;
        
-       $p = Net::Ping->new();
+       $p = Net::Ping->new("icmp");
   if ($p->ping($host)) {
         logger("PING INFO: $host is alive");
        return 1;
@@ -220,7 +220,7 @@ sub fetchfile {
                                        $allok = 1;
                                        return 0;
                                } else {
-                                       logger("DOWNLOAD ERROR: Could not open $Conf::cachedir/$bfile for writing.");
+                                       logger("DOWNLOAD ERROR: Could not open $Conf::tmpdir/$bfile for writing.");
                                }
                        } else {
                                return 0;
@@ -305,7 +305,12 @@ sub selectmirror {
                }
        }
        logger("MIRROR INFO: $scount servers found in list");
-       
+
+       if ($scount eq 0) {
+               logger("MIRROR INFO: Could not find any servers. Falling back to main server $Conf::mainserver");
+               return ("HTTP", $Conf::mainserver, "/$Conf::version");
+       }
+
        ### Choose a random server and test if it is online
        #   If the check fails try a new server.
        #   This will never give up.
@@ -388,6 +393,7 @@ sub dbgetlist {
        foreach $file (@files) {
                next if ( $file eq "." );
                next if ( $file eq ".." );
+               next if ( $file eq "meta-" );
                next if ( $file =~ /^old/ );
                open(FILE, "<$Conf::dbdir/meta/$file");
                @meta = <FILE>;
@@ -584,6 +590,25 @@ sub resolvedeps {
        return @all;
 }
 
+sub resolvedeps_recursive {
+       my @packages = @_;
+       my @result = ();
+
+       foreach my $pkg (@packages) {
+               my @deps = &Pakfire::resolvedeps($pkg);
+
+               foreach my $dep (@deps) {
+                       push(@result, $dep);
+               }
+       }
+
+       # Sort the result array and remove dupes
+       my %sort = map{ $_, 1 } @result;
+       @result = keys %sort;
+
+       return @result;
+}
+
 sub cleanup {
        my $dir = shift;
        my $path;
@@ -690,7 +715,7 @@ sub getpak {
        }
        
        unless ($file) {
-               message("No filename given in meta-file. Please phone the developers.");
+               message("No filename given in meta-file.");
                exit 1;
        }
        
@@ -865,7 +890,8 @@ sub checkcryptodb {
        unless ( "$ret" eq "0" ) {
                message("CRYPTO WARN: The GnuPG isn't configured corectly. Trying now to fix this.");
                message("CRYPTO WARN: It's normal to see this on first execution.");
-               my $command = "gpg --keyserver pgp.mit.edu --always-trust --status-fd 2";
+               message("CRYPTO WARN: If this message is being shown repeatedly, check if time and date are set correctly, and if IPFire can connect via port 11371 TCP.");
+               my $command = "gpg --keyserver pgp.ipfire.org --always-trust --status-fd 2";
                system("$command --recv-key $myid >> $Conf::logdir/gnupg-database.log 2>&1");
                system("$command --recv-key $trustid >> $Conf::logdir/gnupg-database.log 2>&1");
        } else {