|
|
1.1 root 1: #!/bin/sh
2: cat <<'EOF'
3: #!/bin/sh
4: #
5: # program to set up symbolic or hard links the way you need them
6: #
7: linktype=
8: while :
9: do
10: echo -n "Do you want symbolic links (if no, you get hard links)? "
11: read ans
12: case "$ans" in
13: y*) linktype=symbolic
14: break
15: ;;
16: n*) break
17: ;;
18: *) echo "type y or n"
19: ;;
20: esac
21: done
22:
23: while read file linkto type
24: do
25: case "$linktype" in
26: symbolic)
27: echo ln -s $linkto $file
28: ln -s $linkto $file
29: ;;
30: *)
31: case "$type" in
32: file)
33: linkto=`echo "$file $linkto" | sed -e 's/\/[^\/]* /\//'`
34: echo ln $linkto $file
35: ln $linkto $file
36: ;;
37: directory)
38: echo "mkdir $file; cd $file; ln ../$linkto/* ."
39: (mkdir $file; cd $file; ln ../$linkto/* .)
40: ;;
41: esac
42: ;;
43: esac
44: done <<funky-EOF
45: EOF
46:
47: trap "rm -f $TMP; exit 0" 0 1 2
48: TMP=/tmp/mklnk.$$
49: (
50: cd $1
51: find . -type l -print \
52: | while read file
53: do
54: if [ -d $file ]
55: then
56: type=directory
57: else
58: type=file
59: fi
60: linkto=`ls -ld $file | sed -e 's/.* -> //'`
61: case "$type" in
62: directory)
63: echo $file $linkto $type
64: ;;
65: file)
66: echo $file $linkto $type >> $TMP
67: ;;
68: esac
69: done
70: cat $TMP
71: )
72: echo funky-EOF
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.