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;
$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;
}
}
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.
$proto = $templine[0];
$host = $templine[1];
$path = $templine[2];
- if (pinghost("$host")) {
+ if ($pakfiresettings{'HEALTHCHECK'} eq "off") {
+ logger("PING INFO: Healthcheck is disabled");
+ $found = 1;
+ return ($proto, $host, $path);
+ }
+ elsif (pinghost("$host")) {
$found = 1;
return ($proto, $host, $path);
}
fetchfile("lists/packages_list.db", "");
move("$Conf::cachedir/packages_list.db", "$Conf::dbdir/lists/packages_list.db");
}
+
+ # Update the meta database if new packages was in the package list
+ my @meta;
+ my $file;
+ my $line;
+ my $prog;
+ my ($name, $version, $release);
+ my @templine;
+
+ open(FILE, "<$Conf::dbdir/lists/packages_list.db");
+ my @db = <FILE>;
+ close(FILE);
+
+ opendir(DIR,"$Conf::dbdir/meta");
+ my @files = readdir(DIR);
+ closedir(DIR);
+ foreach $file (@files) {
+ next if ( $file eq "." );
+ next if ( $file eq ".." );
+ next if ( $file =~ /^old/ );
+ open(FILE, "<$Conf::dbdir/meta/$file");
+ @meta = <FILE>;
+ close(FILE);
+ foreach $line (@meta) {
+ @templine = split(/\: /,$line);
+ if ("$templine[0]" eq "Name") {
+ $name = $templine[1];
+ chomp($name);
+ } elsif ("$templine[0]" eq "ProgVersion") {
+ $version = $templine[1];
+ chomp($version);
+ } elsif ("$templine[0]" eq "Release") {
+ $release = $templine[1];
+ chomp($release);
+ }
+ }
+ foreach $prog (@db) {
+ @templine = split(/\;/,$prog);
+ if (("$name" eq "$templine[0]") && ("$release" ne "$templine[2]")) {
+ move("$Conf::dbdir/meta/meta-$name","$Conf::dbdir/meta/old_meta-$name");
+ fetchfile("meta/meta-$name", "");
+ move("$Conf::cachedir/meta-$name", "$Conf::dbdir/meta/meta-$name");
+ }
+ }
+ }
}
sub dblist {
close(FILE);
if ("$filter" eq "upgrade") {
- if ("$forweb" ne "forweb") {getcoredb("noforce");}
+ if ("$forweb" ne "forweb" && "$forweb" ne "notice" ) {getcoredb("noforce");}
eval(`grep "core_" $Conf::dbdir/lists/core-list.db`);
if ("$core_release" > "$Conf::core_mine") {
if ("$forweb" eq "forweb") {
print "<option value=\"core\">Core-Update -- $Conf::version -- Release: $Conf::core_mine -> $core_release</option>\n";
+ }
+ elsif ("$forweb" eq "notice") {
+ print "<br /><br /><br /><a href='pakfire.cgi'>$Lang::tr{'core notice 1'} $Conf::core_mine $Lang::tr{'core notice 2'} $core_release $Lang::tr{'core notice 3'}</a>";
} else {
my $command = "Core-Update $Conf::version\nRelease: $Conf::core_mine -> $core_release\n";
if ("$Pakfire::enable_colors" eq "1") {
}
}
- opendir(DIR,"$Conf::dbdir/meta");
+ opendir(DIR,"$Conf::dbdir/installed");
my @files = readdir(DIR);
closedir(DIR);
foreach $file (@files) {
next if ( $file eq "." );
next if ( $file eq ".." );
next if ( $file =~ /^old/ );
- open(FILE, "<$Conf::dbdir/meta/$file");
+ open(FILE, "<$Conf::dbdir/installed/$file");
@meta = <FILE>;
close(FILE);
foreach $line (@meta) {
}
foreach $prog (@db) {
@templine = split(/\;/,$prog);
- if (("$name" eq "$templine[0]") && ("$release" < "$templine[2]" )) {
+ if (("$name" eq "$templine[0]") && ("$release" < "$templine[2]" && "$forweb" ne "notice")) {
push(@updatepaks,$name);
if ("$forweb" eq "forweb") {
print "<option value=\"$name\">Update: $name -- Version: $version -> $templine[1] -- Release: $release -> $templine[2]</option>\n";
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";
+ 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 {