Commit | Line | Data |
---|---|---|
c6667804 | 1 | ?RCS: $Id$ |
d8875586 MBT |
2 | ?RCS: |
3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi | |
4 | ?RCS: | |
c6667804 | 5 | ?RCS: You may redistribute only under the terms of the Artistic License, |
d8875586 MBT |
6 | ?RCS: as specified in the README file that comes with the distribution. |
7 | ?RCS: You may reuse parts of this distribution only within the terms of | |
c6667804 | 8 | ?RCS: that same Artistic License; a copy of which may be found at the root |
d8875586 MBT |
9 | ?RCS: of the source tree for dist 4.0. |
10 | ?RCS: | |
11 | ?RCS: Copyright (c) 2000, Jarkko Hietaniemi | |
12 | ?RCS: | |
13 | ?X: | |
14 | ?X: This unit allows the duplication of the source tree to the current | |
15 | ?X: directory via symbolic links. This must be requested explicitly | |
16 | ?X: by them issuing a -Dmksymlinks on the command line. | |
17 | ?X: | |
18 | ?MAKE:Mksymlinks: Mkdirp lns issymlink src rsrc pkgsrc | |
19 | ?MAKE: -pick add $@ %< | |
20 | ?F:!UU | |
21 | ?T: dir filename tmppwd filelist | |
22 | ?LINT:extern mksymlinks | |
23 | @if {test -f ../MANIFEST} | |
24 | : Duplicate the tree with symbolic links if -Dmksymlinks was supplied | |
25 | case "$mksymlinks" in | |
26 | $define|true|[yY]*) | |
27 | echo " " | |
28 | case "$src" in | |
29 | ''|'.') echo "Cannot create symlinks in the original directory." >&4 | |
30 | exit 1 | |
31 | ;; | |
32 | *) case "$lns:$issymlink" in | |
33 | *"ln"*" -s:"*"test -"?) | |
34 | echo "Creating the symbolic links..." >&4 | |
35 | echo "(First creating the subdirectories...)" >&4 | |
36 | cd .. | |
37 | awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | \ | |
38 | sort -u | while true | |
39 | do | |
40 | read dir | |
41 | test -z "$dir" && break | |
42 | ./UU/mkdirp $dir 2>/dev/null | |
43 | if test -d $dir; then | |
44 | : ok | |
45 | else | |
46 | echo "Failed to create '$dir'. Aborting." >&4 | |
47 | exit 1 | |
48 | fi | |
49 | done | |
50 | echo "(Now creating the symlinks...)" >&4 | |
51 | awk '{print $1}' $src/MANIFEST | while true; do | |
52 | read filename | |
53 | test -z "$filename" && break | |
54 | if test -f $filename; then | |
55 | if $issymlink $filename; then | |
56 | rm -f $filename | |
57 | fi | |
58 | fi | |
59 | if test -f $filename; then | |
60 | echo "$filename already exists, not symlinking." | |
61 | else | |
62 | ?X: Note that the following works because "$pkgsrc" is absolute | |
63 | ln -s $pkgsrc/$filename $filename | |
64 | fi | |
65 | done | |
66 | ?X: Check that everything was correctly copied | |
67 | echo "(Checking current directory...)" >&4 | |
68 | cd UU | |
69 | awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \ | |
70 | (split -l 50 2>/dev/null || split -50) | |
71 | rm -f missing | |
72 | tmppwd=`pwd` | |
73 | for filelist in x??; do | |
74 | (cd ..; ls `cat "$tmppwd/$filelist"` \ | |
75 | >/dev/null 2>>"$tmppwd/missing") | |
76 | done | |
77 | if test -s missing; then | |
78 | echo "Failed duplication of source tree. Aborting." >&4 | |
79 | exit 1 | |
80 | fi | |
81 | ;; | |
82 | *) echo "(I cannot figure out how to do symbolic links, ignoring!)" >&4 | |
83 | ;; | |
84 | esac | |
85 | ;; | |
86 | esac | |
87 | ;; | |
88 | esac | |
89 | ||
90 | @end |