40
|
1 #! /bin/sh
|
|
2 # installml.sh --- install or uninstall manpage links for Vim
|
|
3 #
|
|
4 # arguments:
|
|
5 # 1 what: "install" or "uninstall"
|
|
6 # 2 also do GUI pages: "yes" or ""
|
856
|
7 # 3 target directory e.g., "/usr/local/man/it/man1"
|
|
8 # 4 vim exe name e.g., "vim"
|
|
9 # 5 vimdiff exe name e.g., "vimdiff"
|
|
10 # 6 evim exe name e.g., "evim"
|
|
11 # 7 ex exe name e.g., "ex"
|
|
12 # 8 view exe name e.g., "view"
|
|
13 # 9 rvim exe name e.g., "rvim"
|
|
14 # 10 rview exe name e.g., "rview"
|
|
15 # 11 gvim exe name e.g., "gvim"
|
|
16 # 12 gview exe name e.g., "gview"
|
|
17 # 13 rgvim exe name e.g., "rgvim"
|
|
18 # 14 rgview exe name e.g., "rgview"
|
|
19 # 15 gvimdiff exe name e.g., "gvimdiff"
|
|
20 # 16 eview exe name e.g., "eview"
|
40
|
21
|
|
22 errstatus=0
|
|
23
|
|
24 what=$1
|
|
25 gui=$2
|
|
26 destdir=$3
|
|
27 vimname=$4
|
|
28 vimdiffname=$5
|
|
29 evimname=$6
|
|
30 exname=$7
|
|
31 viewname=$8
|
|
32 rvimname=$9
|
819
|
33 # old shells don't understand ${10}
|
|
34 shift
|
|
35 rviewname=$9
|
|
36 shift
|
|
37 gvimname=$9
|
|
38 shift
|
|
39 gviewname=$9
|
|
40 shift
|
|
41 rgvimname=$9
|
|
42 shift
|
|
43 rgviewname=$9
|
|
44 shift
|
|
45 gvimdiffname=$9
|
|
46 shift
|
|
47 eviewname=$9
|
40
|
48
|
819
|
49 if test $what = "install" -a \( -f $destdir/$vimname.1 -o -f $destdir/$vimdiffname.1 -o -f $destdir/$eviewname.1 \); then
|
40
|
50 if test ! -d $destdir; then
|
|
51 echo creating $destdir
|
|
52 ./mkinstalldirs $destdir
|
|
53 fi
|
|
54
|
|
55 # ex
|
819
|
56 if test ! -f $destdir/$exname.1 -a -f $destdir/$vimname.1; then
|
40
|
57 echo creating link $destdir/$exname.1
|
|
58 cd $destdir; ln -s $vimname.1 $exname.1
|
|
59 fi
|
|
60
|
|
61 # view
|
819
|
62 if test ! -f $destdir/$viewname.1 -a -f $destdir/$vimname.1; then
|
40
|
63 echo creating link $destdir/$viewname.1
|
|
64 cd $destdir; ln -s $vimname.1 $viewname.1
|
|
65 fi
|
|
66
|
|
67 # rvim
|
819
|
68 if test ! -f $destdir/$rvimname.1 -a -f $destdir/$vimname.1; then
|
40
|
69 echo creating link $destdir/$rvimname.1
|
|
70 cd $destdir; ln -s $vimname.1 $rvimname.1
|
|
71 fi
|
|
72
|
|
73 # rview
|
819
|
74 if test ! -f $destdir/$rviewname.1 -a -f $destdir/$vimname.1; then
|
40
|
75 echo creating link $destdir/$rviewname.1
|
|
76 cd $destdir; ln -s $vimname.1 $rviewname.1
|
|
77 fi
|
|
78
|
|
79 # GUI targets are optional
|
|
80 if test "$gui" = "yes"; then
|
|
81 # gvim
|
819
|
82 if test ! -f $destdir/$gvimname.1 -a -f $destdir/$vimname.1; then
|
40
|
83 echo creating link $destdir/$gvimname.1
|
|
84 cd $destdir; ln -s $vimname.1 $gvimname.1
|
|
85 fi
|
|
86
|
|
87 # gview
|
819
|
88 if test ! -f $destdir/$gviewname.1 -a -f $destdir/$vimname.1; then
|
40
|
89 echo creating link $destdir/$gviewname.1
|
|
90 cd $destdir; ln -s $vimname.1 $gviewname.1
|
|
91 fi
|
|
92
|
|
93 # rgvim
|
819
|
94 if test ! -f $destdir/$rgvimname.1 -a -f $destdir/$vimname.1; then
|
40
|
95 echo creating link $destdir/$rgvimname.1
|
|
96 cd $destdir; ln -s $vimname.1 $rgvimname.1
|
|
97 fi
|
|
98
|
|
99 # rgview
|
819
|
100 if test ! -f $destdir/$rgviewname.1 -a -f $destdir/$vimname.1; then
|
40
|
101 echo creating link $destdir/$rgviewname.1
|
|
102 cd $destdir; ln -s $vimname.1 $rgviewname.1
|
|
103 fi
|
|
104
|
|
105 # gvimdiff
|
819
|
106 if test ! -f $destdir/$gvimdiffname.1 -a -f $destdir/$vimdiffname.1; then
|
40
|
107 echo creating link $destdir/$gvimdiffname.1
|
|
108 cd $destdir; ln -s $vimdiffname.1 $gvimdiffname.1
|
|
109 fi
|
|
110
|
|
111 # eview
|
819
|
112 if test ! -f $destdir/$eviewname.1 -a -f $destdir/$evimname.1; then
|
40
|
113 echo creating link $destdir/$eviewname.1
|
|
114 cd $destdir; ln -s $evimname.1 $eviewname.1
|
|
115 fi
|
|
116 fi
|
|
117 fi
|
|
118
|
|
119 if test $what = "uninstall"; then
|
|
120 echo Checking for Vim manual page links in $destdir...
|
|
121
|
|
122 if test -L $destdir/$exname.1; then
|
|
123 echo deleting $destdir/$exname.1
|
|
124 rm -f $destdir/$exname.1
|
|
125 fi
|
|
126 if test -L $destdir/$viewname.1; then
|
|
127 echo deleting $destdir/$viewname.1
|
|
128 rm -f $destdir/$viewname.1
|
|
129 fi
|
|
130 if test -L $destdir/$rvimname.1; then
|
|
131 echo deleting $destdir/$rvimname.1
|
|
132 rm -f $destdir/$rvimname.1
|
|
133 fi
|
|
134 if test -L $destdir/$rviewname.1; then
|
|
135 echo deleting $destdir/$rviewname.1
|
|
136 rm -f $destdir/$rviewname.1
|
|
137 fi
|
|
138
|
|
139 # GUI targets are optional
|
|
140 if test "$gui" = "yes"; then
|
|
141 if test -L $destdir/$gvimname.1; then
|
|
142 echo deleting $destdir/$gvimname.1
|
|
143 rm -f $destdir/$gvimname.1
|
|
144 fi
|
|
145 if test -L $destdir/$gviewname.1; then
|
|
146 echo deleting $destdir/$gviewname.1
|
|
147 rm -f $destdir/$gviewname.1
|
|
148 fi
|
|
149 if test -L $destdir/$rgvimname.1; then
|
|
150 echo deleting $destdir/$rgvimname.1
|
|
151 rm -f $destdir/$rgvimname.1
|
|
152 fi
|
|
153 if test -L $destdir/$rgviewname.1; then
|
|
154 echo deleting $destdir/$rgviewname.1
|
|
155 rm -f $destdir/$rgviewname.1
|
|
156 fi
|
|
157 if test -L $destdir/$gvimdiffname.1; then
|
|
158 echo deleting $destdir/$gvimdiffname.1
|
|
159 rm -f $destdir/$gvimdiffname.1
|
|
160 fi
|
|
161 if test -L $destdir/$eviewname.1; then
|
|
162 echo deleting $destdir/$eviewname.1
|
|
163 rm -f $destdir/$eviewname.1
|
|
164 fi
|
|
165 fi
|
|
166 fi
|
|
167
|
|
168 exit $errstatus
|
|
169
|
|
170 # vim: set sw=3 :
|