]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/pakfire/lib/functions.pl
pakfire: Allow pinning Pakfire to one mirror server
[people/pmueller/ipfire-2.x.git] / src / pakfire / lib / functions.pl
index f46c9acc138032301df5cffa0865f34deb6b43c6..4d9854a6fd9ce3b53d71959702d3a70ad078bfa5 100644 (file)
@@ -30,6 +30,7 @@ use HTTP::Headers;
 use HTTP::Message;
 use HTTP::Request;
 use Net::Ping;
+use URI;
 
 use Switch;
 
@@ -297,6 +298,17 @@ sub valid_signature($) {
 }
 
 sub selectmirror {
+       if (defined ${Conf::mirror}) {
+               my $uri = URI->new("${Conf::mirror}");
+
+               # Only accept HTTPS mirrors
+               if ($uri->scheme eq "https") {
+                       return ("HTTPS", $uri->host, $uri->path . "/" . ${Conf::version});
+               } else {
+                       message("MIRROR ERROR: Unsupported mirror: " . ${Conf::mirror});
+               }
+       }
+
        ### Check if there is a current server list and read it.
        #   If there is no list try to get one.
        my $count = 0;