summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2011-02-01 14:39:37 -0500
committerEamon Walsh <ewalsh@tycho.nsa.gov>2011-02-01 14:39:37 -0500
commitf502c0c3a90a0eb0d16d89de21090d7790e099ef (patch)
tree93d7dfaf04525e2489403b636eec7af907e66090
parent42d95fa4148e064a239198053f90544ace966ce5 (diff)
Add yum repository fixing script.
-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";
+}
+