Merged from the latest developing branch.
[MacVim.git] / src / installml.sh
blobe6dc3d8f326e25a1feb1048f597cded9657f1755
1 #! /bin/sh
2 # installml.sh --- install or uninstall manpage links for Vim
4 # arguments:
5 # 1 what: "install" or "uninstall"
6 # 2 also do GUI pages: "yes" or ""
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"
22 errstatus=0
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
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
49 if test $what = "install" -a \( -f $destdir/$vimname.1 -o -f $destdir/$vimdiffname.1 -o -f $destdir/$eviewname.1 \); then
50 if test ! -d $destdir; then
51 echo creating $destdir
52 ./mkinstalldirs $destdir
55 # ex
56 if test ! -f $destdir/$exname.1 -a -f $destdir/$vimname.1; then
57 echo creating link $destdir/$exname.1
58 cd $destdir; ln -s $vimname.1 $exname.1
61 # view
62 if test ! -f $destdir/$viewname.1 -a -f $destdir/$vimname.1; then
63 echo creating link $destdir/$viewname.1
64 cd $destdir; ln -s $vimname.1 $viewname.1
67 # rvim
68 if test ! -f $destdir/$rvimname.1 -a -f $destdir/$vimname.1; then
69 echo creating link $destdir/$rvimname.1
70 cd $destdir; ln -s $vimname.1 $rvimname.1
73 # rview
74 if test ! -f $destdir/$rviewname.1 -a -f $destdir/$vimname.1; then
75 echo creating link $destdir/$rviewname.1
76 cd $destdir; ln -s $vimname.1 $rviewname.1
79 # GUI targets are optional
80 if test "$gui" = "yes"; then
81 # gvim
82 if test ! -f $destdir/$gvimname.1 -a -f $destdir/$vimname.1; then
83 echo creating link $destdir/$gvimname.1
84 cd $destdir; ln -s $vimname.1 $gvimname.1
87 # gview
88 if test ! -f $destdir/$gviewname.1 -a -f $destdir/$vimname.1; then
89 echo creating link $destdir/$gviewname.1
90 cd $destdir; ln -s $vimname.1 $gviewname.1
93 # rgvim
94 if test ! -f $destdir/$rgvimname.1 -a -f $destdir/$vimname.1; then
95 echo creating link $destdir/$rgvimname.1
96 cd $destdir; ln -s $vimname.1 $rgvimname.1
99 # rgview
100 if test ! -f $destdir/$rgviewname.1 -a -f $destdir/$vimname.1; then
101 echo creating link $destdir/$rgviewname.1
102 cd $destdir; ln -s $vimname.1 $rgviewname.1
105 # gvimdiff
106 if test ! -f $destdir/$gvimdiffname.1 -a -f $destdir/$vimdiffname.1; then
107 echo creating link $destdir/$gvimdiffname.1
108 cd $destdir; ln -s $vimdiffname.1 $gvimdiffname.1
111 # eview
112 if test ! -f $destdir/$eviewname.1 -a -f $destdir/$evimname.1; then
113 echo creating link $destdir/$eviewname.1
114 cd $destdir; ln -s $evimname.1 $eviewname.1
119 if test $what = "uninstall"; then
120 echo Checking for Vim manual page links in $destdir...
122 if test -L $destdir/$exname.1; then
123 echo deleting $destdir/$exname.1
124 rm -f $destdir/$exname.1
126 if test -L $destdir/$viewname.1; then
127 echo deleting $destdir/$viewname.1
128 rm -f $destdir/$viewname.1
130 if test -L $destdir/$rvimname.1; then
131 echo deleting $destdir/$rvimname.1
132 rm -f $destdir/$rvimname.1
134 if test -L $destdir/$rviewname.1; then
135 echo deleting $destdir/$rviewname.1
136 rm -f $destdir/$rviewname.1
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
145 if test -L $destdir/$gviewname.1; then
146 echo deleting $destdir/$gviewname.1
147 rm -f $destdir/$gviewname.1
149 if test -L $destdir/$rgvimname.1; then
150 echo deleting $destdir/$rgvimname.1
151 rm -f $destdir/$rgvimname.1
153 if test -L $destdir/$rgviewname.1; then
154 echo deleting $destdir/$rgviewname.1
155 rm -f $destdir/$rgviewname.1
157 if test -L $destdir/$gvimdiffname.1; then
158 echo deleting $destdir/$gvimdiffname.1
159 rm -f $destdir/$gvimdiffname.1
161 if test -L $destdir/$eviewname.1; then
162 echo deleting $destdir/$eviewname.1
163 rm -f $destdir/$eviewname.1
168 exit $errstatus
170 # vim: set sw=3 :