Browse Source

Quick script to change gitlab paths to my new server

spesk1 4 years ago
parent
commit
a2fbe2c8dd
1 changed files with 11 additions and 0 deletions
  1. 11 0
      findGitlab.pl

+ 11 - 0
findGitlab.pl

@@ -3,15 +3,26 @@
 use strict;
 use warnings;
 
+my $pwd = `echo \$PWD`;
+chomp $pwd;
+print "PWD is: $pwd\n";
+
 sub find_origin {
 	my $path = shift;
 	my $configFile = $path . "config";
 	if ( -f $configFile ) {
 		my $origin = `cat $configFile  | grep url | awk {'print \$3}'`;
 		chomp $origin;
+		my $replaceSite = "spwbk.site:";
 		if ( $origin =~ m/@(.*)\:/ ) {
 			if ( $1 ne "spwbk.site" ) {
 				print "$path has origin: $origin that does not match spwbk.site\n";
+				print "cd'ing into $path...\n";
+				my $replaceCmd = "sed -i s?$1:spesk1/?$replaceSite?g $configFile";
+				print "Using sed to replace $1 with spwbk.site -> $replaceCmd\n";
+				my $output = `$replaceCmd`;
+				chomp $output;
+				print "Output was: $output\n";
 			}
 		}
 	}