summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2010-10-18 21:05:14 +0200
committerDaniel Friesel <derf@finalrewind.org>2010-10-18 21:05:14 +0200
commit4b3e57a113f6d8b2d940aff721c117cba04423b1 (patch)
treec031a756cf91fd34b6707af10e272bad0a526ebf
parentacb2b7b45ad87d0f163fd1793d07d8ea9851f9be (diff)
checklinks: Workaround to conserve BC for previous commit (absolute $etc)
-rwxr-xr-xbin/checklinks20
1 files changed, 18 insertions, 2 deletions
diff --git a/bin/checklinks b/bin/checklinks
index 97137b0..29d676b 100755
--- a/bin/checklinks
+++ b/bin/checklinks
@@ -11,7 +11,7 @@ use Term::ANSIColor;
my $base = $ENV{HOME};
my $msglevel = 0;
my $remove = 0;
-my %substitute;
+my (%substitute, %bc_subst);
my $linkfile;
my $exit = 0;
my $ct_auto = 0;
@@ -182,6 +182,16 @@ GetOptions(
'r|remove' => \$remove,
);
+foreach my $key (keys %substitute) {
+
+ my $path = $substitute{$key};
+
+ $path =~ s/ ^ $ENV{HOME}//x;
+
+ $bc_subst{$key} = $path;
+
+}
+
if ($ct_auto) {
loop_links();
exit 0;
@@ -195,7 +205,13 @@ while (my $line = <$links>) {
chomp($line);
foreach my $key (keys(%substitute)) {
- $line =~ s/\$$key/$substitute{$key}/g;
+
+ if ($line =~ / ^ \S+ \s+ \S+ \s+ \$ /x) {
+ $line =~ s/\$$key/$substitute{$key}/g;
+ }
+ else {
+ $line =~ s/\$$key/$bc_subst{$key}/g;
+ }
}
my ($type, $src, $dst) = split(/\s+/, $line);