blob: b49d2671cdba181d0123dfccd571b93c9492c03b [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
28vimdiffname=${10}
29evimname=${11}
30
31helpsubloc=$scriptloc/doc
32synsubloc=$scriptloc/syntax
33tutorsubloc=$scriptloc/tutor
34
35if test $what = "install" -o $what = "xxd"; then
36 if test ! -d $destdir; then
37 echo creating $destdir
38 ./mkinstalldirs $destdir
39 fi
40fi
41
42if test $what = "install"; then
43 # vim.1
44 echo installing $destdir/$exename.1
45 sed -e s+/usr/local/lib/vim+$vimloc+ \
46 -e s+$vimloc/doc+$helpsubloc+ \
47 -e s+$vimloc/syntax+$synsubloc+ \
48 -e s+$vimloc/tutor+$tutorsubloc+ \
49 -e s+$vimloc/vimrc+$vimrcloc/vimrc+ \
50 -e s+$vimloc/gvimrc+$vimrcloc/gvimrc+ \
51 -e s+$vimloc/menu.vim+$scriptloc/menu.vim+ \
52 -e s+$vimloc/bugreport.vim+$scriptloc/bugreport.vim+ \
53 -e s+$vimloc/filetype.vim+$scriptloc/filetype.vim+ \
54 -e s+$vimloc/ftoff.vim+$scriptloc/ftoff.vim+ \
55 -e s+$vimloc/scripts.vim+$scriptloc/scripts.vim+ \
56 -e s+$vimloc/optwin.vim+$scriptloc/optwin.vim+ \
57 -e 's+$vimloc/\*.ps+$scriptloc/\*.ps+' \
58 $helpsource/vim$langadd.1 > $destdir/$exename.1
59 chmod $manmod $destdir/$exename.1
60
61 # vimtutor.1
62 echo installing $destdir/$exename""tutor.1
63 sed -e s+/usr/local/lib/vim+$vimloc+ \
64 -e s+$vimloc/tutor+$tutorsubloc+ \
65 $helpsource/vimtutor$langadd.1 > $destdir/$exename""tutor.1
66 chmod $manmod $destdir/$exename""tutor.1
67
68 # vimdiff.1
69 echo installing $destdir/$vimdiffname.1
70 cp $helpsource/vimdiff$langadd.1 $destdir/$vimdiffname.1
71 chmod $manmod $destdir/$vimdiffname.1
72
73 # evim.1
74 echo installing $destdir/$evimname.1
75 sed -e s+/usr/local/lib/vim+$vimloc+ \
76 $helpsource/evim$langadd.1 > $destdir/$evimname.1
77 chmod $manmod $destdir/$evimname.1
78fi
79
80if test $what = "uninstall"; then
81 echo Checking for Vim manual pages in $destdir...
82 if test -r $destdir/$exename.1; then
83 echo deleting $destdir/$exename.1
84 rm -f $destdir/$exename.1
85 fi
86 if test -r $destdir/$exename""tutor.1; then
87 echo deleting $destdir/$exename""tutor.1
88 rm -f $destdir/$exename""tutor.1
89 fi
90 if test -r $destdir/$vimdiffname.1; then
91 echo deleting $destdir/$vimdiffname.1
92 rm -f $destdir/$vimdiffname.1
93 fi
94 if test -r $destdir/$evimname.1; then
95 echo deleting $destdir/$evimname.1
96 rm -f $destdir/$evimname.1
97 fi
98fi
99
100if test $what = "xxd"; then
101 echo installing $destdir/xxd.1
102 cp $helpsource/xxd$langadd.1 $destdir/xxd.1
103 chmod $manmod $destdir/xxd.1
104fi
105
106exit $errstatus
107
108# vim: set sw=3 :