summaryrefslogtreecommitdiff
path: root/yumlocal.pl
diff options
context:
space:
mode:
Diffstat (limited to 'yumlocal.pl')
-rwxr-xr-xyumlocal.pl31
1 files changed, 31 insertions, 0 deletions
diff --git a/yumlocal.pl b/yumlocal.pl
new file mode 100755
index 0000000..e4a8780
--- /dev/null
+++ b/yumlocal.pl
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+my $localserver = "prometheus.epoch.ncsc.mil/";
+my $remoteserver = "download.fedoraproject.org/pub/";
+
+foreach my $file (@ARGV) {
+ print STDERR "Processing '$file'...";
+ open(FH, '<', $file) or die "Failed to open '$file': $!\n";
+ my @lines = <FH>;
+ close(FH);
+
+ for (@lines) {
+ # Set up local server
+ s|$remoteserver|$localserver|g;
+
+ # Turn off mirrorlists
+ s|^mirrorlist|\#mirrorlist|;
+
+ # Turn on baseurl
+ s|^\#baseurl|baseurl|;
+ }
+
+ open(FH, '>', $file) or die "Failed to open '$file' for writing: $!\n";
+ print FH @lines;
+ close(FH) or warn "Failed to close '$file' after writing.\n";
+ print STDERR "done\n";
+}
+