blob: 9943109fe39637064c432517e280383c9f5bcdef [file] [log] [blame]
Bram Moolenaarb5bf5b82004-12-24 14:35:23 +00001#! /bin/sh
2# installman.sh --- install or uninstall manpages for Vim
3#
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"
16
17errstatus=0
18
19what=$1
20destdir=$2
21langadd=$3
22vimloc=$4
23scriptloc=$5
24vimrcloc=$6
25helpsource=$7
26manmod=$8
27exename=$9
Bram Moolenaar910f66f2006-04-05 20:41:53 +000028# older shells don't support ${10}
29shift
30vimdiffname=$9
31shift
32evimname=$9
Bram Moolenaarb5bf5b82004-12-24 14:35:23 +000033
34helpsubloc=$scriptloc/doc
35synsubloc=$scriptloc/syntax
36tutorsubloc=$scriptloc/tutor
37
38if test $what = "install" -o $what = "xxd"; then
39 if test ! -d $destdir; then
40 echo creating $destdir
41 ./mkinstalldirs $destdir
42 fi
43fi
44
45if 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
63
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
70
71 # vimdiff.1
72 echo installing $destdir/$vimdiffname.1
73 cp $helpsource/vimdiff$langadd.1 $destdir/$vimdiffname.1
74 chmod $manmod $destdir/$vimdiffname.1
75
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
81fi
82
83if 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
88 fi
89 if test -r $destdir/$exename""tutor.1; then
90 echo deleting $destdir/$exename""tutor.1
91 rm -f $destdir/$exename""tutor.1
92 fi
93 if test -r $destdir/$vimdiffname.1; then
94 echo deleting $destdir/$vimdiffname.1
95 rm -f $destdir/$vimdiffname.1
96 fi
97 if test -r $destdir/$evimname.1; then
98 echo deleting $destdir/$evimname.1
99 rm -f $destdir/$evimname.1
100 fi
101fi
102
103if 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
107fi
108
109exit $errstatus
110
Bram Moolenaar11cbeb12005-03-11 22:51:16 +0000111# vim: set sw=3 sts=3 :