Permalink
Browse files

support .prepare file.

"exclude filename" will prevent the script from creating symbolic link.
  • Loading branch information...
itojun
itojun committed Aug 1, 1999
1 parent 57db46d commit 8714844e32346b0dbd77d77bcff1714347fa6309
Showing with 25 additions and 2 deletions.
  1. +4 −0 Makefile
  2. +21 −2 prepare.pl
View
@@ -0,0 +1,4 @@
+TARGET?= netbsd
+
+prepare::
+ perl prepare.pl kame ${TARGET}
View
@@ -15,12 +15,27 @@
sub dig {
local($curdir, $src, $dst) = @_;
local(@all);
+ local(%exclude);
print "start: $curdir, $src, $dst\n";
opendir(DIR, $curdir);
@all = readdir(DIR);
closedir(DIR);
+
+ if (-f "$dst/.prepare") {
+ %exclude = ();
+ open(IN, "< $dst/.prepare");
+ while (<IN>) {
+ s/\n$//;
+ if (/^exclude\s+(\S+)$/) {
+ $exclude{$1}++;
+ }
+ }
+ close(IN);
+ print "exclude in $dst: " . join(keys %exclude) . "\n"
+ if ($debug);
+ }
foreach $i (@all) {
next if ($i eq '.');
next if ($i eq '..');
@@ -42,8 +57,12 @@ sub dig {
print "unlink $dst/$i (symlink)\n" if $debug;
unlink "$dst/$i";
}
- print "ln -s $src/$i $dst/$i\n" if $debug;
- symlink "$src/$i", "$dst/$i" if (!$test);
+ if ($exclude{$i}) {
+ print "exclude $dst/$i\n" if $debug;
+ } else {
+ print "ln -s $src/$i $dst/$i\n" if $debug;
+ symlink "$src/$i", "$dst/$i" if (!$test);
+ }
}
}
}

0 comments on commit 8714844

Please sign in to comment.