ODB Editor protocol (aka 'external editor') support
[MacVim.git] / src / installman.sh
blob25a24e652b5432c9fd877b41232a09dedc744e80
1 #! /bin/sh
2 # installman.sh --- install or uninstall manpages for Vim
4 # arguments:
5 # 1 what: "install", "uninstall" or "xxd"
6 # 2 target directory e.g., "/usr/local/man/it/man1"
7 # 3 language addition e.g., "" or "-it"
8 # 4 vim location as used in manual pages e.g., "/usr/local/share/vim"
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"
17 errstatus=0
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
28 # older shells don't support ${10}
29 shift
30 vimdiffname=$9
31 shift
32 evimname=$9
34 helpsubloc=$scriptloc/doc
35 synsubloc=$scriptloc/syntax
36 tutorsubloc=$scriptloc/tutor
38 if test $what = "install" -o $what = "xxd"; then
39 if test ! -d $destdir; then
40 echo creating $destdir
41 ./mkinstalldirs $destdir
45 if test $what = "install"; then
46 # vim.1
47 echo installing $destdir/$exename.1
48 sed -e s+/usr/local/lib/vim+$vimloc+ \
49 -e s+$vimloc/doc+$helpsubloc+ \
50 -e s+$vimloc/syntax+$synsubloc+ \
51 -e s+$vimloc/tutor+$tutorsubloc+ \
52 -e s+$vimloc/vimrc+$vimrcloc/vimrc+ \
53 -e s+$vimloc/gvimrc+$vimrcloc/gvimrc+ \
54 -e s+$vimloc/menu.vim+$scriptloc/menu.vim+ \
55 -e s+$vimloc/bugreport.vim+$scriptloc/bugreport.vim+ \
56 -e s+$vimloc/filetype.vim+$scriptloc/filetype.vim+ \
57 -e s+$vimloc/ftoff.vim+$scriptloc/ftoff.vim+ \
58 -e s+$vimloc/scripts.vim+$scriptloc/scripts.vim+ \
59 -e s+$vimloc/optwin.vim+$scriptloc/optwin.vim+ \
60 -e 's+$vimloc/\*.ps+$scriptloc/\*.ps+' \
61 $helpsource/vim$langadd.1 > $destdir/$exename.1
62 chmod $manmod $destdir/$exename.1
64 # vimtutor.1
65 echo installing $destdir/$exename""tutor.1
66 sed -e s+/usr/local/lib/vim+$vimloc+ \
67 -e s+$vimloc/tutor+$tutorsubloc+ \
68 $helpsource/vimtutor$langadd.1 > $destdir/$exename""tutor.1
69 chmod $manmod $destdir/$exename""tutor.1
71 # vimdiff.1
72 echo installing $destdir/$vimdiffname.1
73 cp $helpsource/vimdiff$langadd.1 $destdir/$vimdiffname.1
74 chmod $manmod $destdir/$vimdiffname.1
76 # evim.1
77 echo installing $destdir/$evimname.1
78 sed -e s+/usr/local/lib/vim+$vimloc+ \
79 $helpsource/evim$langadd.1 > $destdir/$evimname.1
80 chmod $manmod $destdir/$evimname.1
83 if test $what = "uninstall"; then
84 echo Checking for Vim manual pages in $destdir...
85 if test -r $destdir/$exename.1; then
86 echo deleting $destdir/$exename.1
87 rm -f $destdir/$exename.1
89 if test -r $destdir/$exename""tutor.1; then
90 echo deleting $destdir/$exename""tutor.1
91 rm -f $destdir/$exename""tutor.1
93 if test -r $destdir/$vimdiffname.1; then
94 echo deleting $destdir/$vimdiffname.1
95 rm -f $destdir/$vimdiffname.1
97 if test -r $destdir/$evimname.1; then
98 echo deleting $destdir/$evimname.1
99 rm -f $destdir/$evimname.1
103 if test $what = "xxd"; then
104 echo installing $destdir/xxd.1
105 cp $helpsource/xxd$langadd.1 $destdir/xxd.1
106 chmod $manmod $destdir/xxd.1
109 exit $errstatus
111 # vim: set sw=3 sts=3 :