always add enabled mirror

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-11-10 15:09:16 +01:00
parent c540795686
commit 03406f3e36
1 changed files with 16 additions and 0 deletions

View File

@ -50,6 +50,17 @@ sub write_file {
$fh->close; $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 { sub copy_file {
my ($a, $b) = @_; my ($a, $b) = @_;
copy($a, $b) or die "failed to copy $a => $b: $!"; copy($a, $b) or die "failed to copy $a => $b: $!";
@ -675,6 +686,11 @@ sub finalize {
unlink $file; unlink $file;
rename_file($file.'.aab_orig', $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"; print "Removing weak temporary pacman keyring...\n";
rmtree("$rootdir/etc/pacman.d/gnupg"); rmtree("$rootdir/etc/pacman.d/gnupg");