]> git.proxmox.com Git - aab.git/commitdiff
always add enabled mirror
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 10 Nov 2022 14:09:16 +0000 (15:09 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 10 Nov 2022 14:09:16 +0000 (15:09 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/AAB.pm

index 14eea2f7e5f63ab20fbdea7de328ce01f89ee887..697c6644cf315c4630bce30183a26482d1f387b3 100644 (file)
@@ -50,6 +50,17 @@ sub write_file {
     $fh->close;
 }
 
+sub read_file {
+    my ($filename) = @_;
+
+    my $fh = IO::File->new ("<$filename") or die "failed to read $filename - $!\n";
+    my $rec = '';
+    while (defined (my $line = <$fh>)) {
+       $rec .= $line;
+    };
+    return $rec;
+}
+
 sub copy_file {
     my ($a, $b) = @_;
     copy($a, $b) or die "failed to copy $a => $b: $!";
@@ -675,6 +686,11 @@ sub finalize {
     unlink $file;
     rename_file($file.'.aab_orig', $file);
 
+    # experienced user can change it anytime and others do well to start out with an updatable system..
+    my $mirrors = eval { read_file($file) } // '';
+    $mirrors = "\nServer = https://geo.mirror.pkgbuild.com/\$repo/os/\$arch\n\n" . $mirrors;
+    write_file($mirrors, $file, 0644);
+
     print "Removing weak temporary pacman keyring...\n";
     rmtree("$rootdir/etc/pacman.d/gnupg");