40
|
1 #! /bin/sh
|
|
2 # installman.sh --- install or uninstall manpages for Vim
|
|
3 #
|
|
4 # arguments:
|
|
5 # 1 what: "install", "uninstall" or "xxd"
|
856
|
6 # 2 target directory e.g., "/usr/local/man/it/man1"
|
40
|
7 # 3 language addition e.g., "" or "-it"
|
|
8 # 4 vim location as used in manual pages e.g., "/usr/local/share/vim"
|
856
|
9 # 5 runtime dir for menu.vim et al. e.g., "/usr/local/share/vim/vim70"
|
|
10 # 6 runtime dir for global vimrc file e.g., "/usr/local/share/vim"
|
|
11 # 7 source dir for help files e.g., "../runtime/doc"
|
|
12 # 8 mode bits for manpages e.g., "644"
|
|
13 # 9 vim exe name e.g., "vim"
|
|
14 # 10 name of vimdiff exe e.g., "vimdiff"
|
|
15 # 11 name of evim exe e.g., "evim"
|
40
|
16
|
|
17 errstatus=0
|
|
18
|
|
19 what=$1
|
|
20 destdir=$2
|
|
21 langadd=$3
|
|
22 vimloc=$4
|
|
23 scriptloc=$5
|
|
24 vimrcloc=$6
|
|
25 helpsource=$7
|
|
26 manmod=$8
|
|
27 exename=$9
|
819
|
28 # older shells don't support ${10}
|
|
29 shift
|
|
30 vimdiffname=$9
|
|
31 shift
|
|
32 evimname=$9
|
40
|
33
|
|
34 helpsubloc=$scriptloc/doc
|
1698
|
35 printsubloc=$scriptloc/print
|
40
|
36 synsubloc=$scriptloc/syntax
|
|
37 tutorsubloc=$scriptloc/tutor
|
|
38
|
|
39 if test $what = "install" -o $what = "xxd"; then
|
|
40 if test ! -d $destdir; then
|
|
41 echo creating $destdir
|
|
42 ./mkinstalldirs $destdir
|
|
43 fi
|
|
44 fi
|
|
45
|
5999
|
46 # Note: setting LC_ALL to C is required to avoid illegal byte errors from sed
|
|
47 # on some systems.
|
|
48
|
40
|
49 if test $what = "install"; then
|
|
50 # vim.1
|
|
51 echo installing $destdir/$exename.1
|
5999
|
52 LC_ALL=C sed -e s+/usr/local/lib/vim+$vimloc+ \
|
40
|
53 -e s+$vimloc/doc+$helpsubloc+ \
|
1698
|
54 -e s+$vimloc/print+$printsubloc+ \
|
40
|
55 -e s+$vimloc/syntax+$synsubloc+ \
|
|
56 -e s+$vimloc/tutor+$tutorsubloc+ \
|
|
57 -e s+$vimloc/vimrc+$vimrcloc/vimrc+ \
|
|
58 -e s+$vimloc/gvimrc+$vimrcloc/gvimrc+ \
|
|
59 -e s+$vimloc/menu.vim+$scriptloc/menu.vim+ \
|
|
60 -e s+$vimloc/bugreport.vim+$scriptloc/bugreport.vim+ \
|
|
61 -e s+$vimloc/filetype.vim+$scriptloc/filetype.vim+ \
|
|
62 -e s+$vimloc/scripts.vim+$scriptloc/scripts.vim+ \
|
|
63 -e s+$vimloc/optwin.vim+$scriptloc/optwin.vim+ \
|
|
64 -e 's+$vimloc/\*.ps+$scriptloc/\*.ps+' \
|
|
65 $helpsource/vim$langadd.1 > $destdir/$exename.1
|
|
66 chmod $manmod $destdir/$exename.1
|
|
67
|
|
68 # vimtutor.1
|
|
69 echo installing $destdir/$exename""tutor.1
|
5999
|
70 LC_ALL=C sed -e s+/usr/local/lib/vim+$vimloc+ \
|
40
|
71 -e s+$vimloc/tutor+$tutorsubloc+ \
|
|
72 $helpsource/vimtutor$langadd.1 > $destdir/$exename""tutor.1
|
|
73 chmod $manmod $destdir/$exename""tutor.1
|
|
74
|
|
75 # vimdiff.1
|
|
76 echo installing $destdir/$vimdiffname.1
|
|
77 cp $helpsource/vimdiff$langadd.1 $destdir/$vimdiffname.1
|
|
78 chmod $manmod $destdir/$vimdiffname.1
|
|
79
|
|
80 # evim.1
|
|
81 echo installing $destdir/$evimname.1
|
5999
|
82 LC_ALL=C sed -e s+/usr/local/lib/vim+$vimloc+ \
|
1698
|
83 -e s+$vimloc/evim.vim+$scriptloc/evim.vim+ \
|
40
|
84 $helpsource/evim$langadd.1 > $destdir/$evimname.1
|
|
85 chmod $manmod $destdir/$evimname.1
|
|
86 fi
|
|
87
|
|
88 if test $what = "uninstall"; then
|
|
89 echo Checking for Vim manual pages in $destdir...
|
|
90 if test -r $destdir/$exename.1; then
|
|
91 echo deleting $destdir/$exename.1
|
|
92 rm -f $destdir/$exename.1
|
|
93 fi
|
|
94 if test -r $destdir/$exename""tutor.1; then
|
|
95 echo deleting $destdir/$exename""tutor.1
|
|
96 rm -f $destdir/$exename""tutor.1
|
|
97 fi
|
|
98 if test -r $destdir/$vimdiffname.1; then
|
|
99 echo deleting $destdir/$vimdiffname.1
|
|
100 rm -f $destdir/$vimdiffname.1
|
|
101 fi
|
|
102 if test -r $destdir/$evimname.1; then
|
|
103 echo deleting $destdir/$evimname.1
|
|
104 rm -f $destdir/$evimname.1
|
|
105 fi
|
|
106 fi
|
|
107
|
|
108 if test $what = "xxd"; then
|
|
109 echo installing $destdir/xxd.1
|
|
110 cp $helpsource/xxd$langadd.1 $destdir/xxd.1
|
|
111 chmod $manmod $destdir/xxd.1
|
|
112 fi
|
|
113
|
|
114 exit $errstatus
|
|
115
|
201
|
116 # vim: set sw=3 sts=3 :
|