blob: dd04e2f816dcd48debed749a54d2dc759419deaa [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"
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00006# 2 target directory e.g., "/usr/local/man/it/man1"
Bram Moolenaarb5bf5b82004-12-24 14:35:23 +00007# 3 language addition e.g., "" or "-it"
8# 4 vim location as used in manual pages e.g., "/usr/local/share/vim"
Bram Moolenaarc9b4b052006-04-30 18:54:39 +00009# 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"
Bram Moolenaarb5bf5b82004-12-24 14:35:23 +000016
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
Bram Moolenaare37d50a2008-08-06 17:06:04 +000035printsubloc=$scriptloc/print
Bram Moolenaarb5bf5b82004-12-24 14:35:23 +000036synsubloc=$scriptloc/syntax
37tutorsubloc=$scriptloc/tutor
38
39if test $what = "install" -o $what = "xxd"; then
40 if test ! -d $destdir; then
41 echo creating $destdir
42 ./mkinstalldirs $destdir
43 fi
44fi
45
46if test $what = "install"; then
47 # vim.1
48 echo installing $destdir/$exename.1
49 sed -e s+/usr/local/lib/vim+$vimloc+ \
50 -e s+$vimloc/doc+$helpsubloc+ \
Bram Moolenaare37d50a2008-08-06 17:06:04 +000051 -e s+$vimloc/print+$printsubloc+ \
Bram Moolenaarb5bf5b82004-12-24 14:35:23 +000052 -e s+$vimloc/syntax+$synsubloc+ \
53 -e s+$vimloc/tutor+$tutorsubloc+ \
54 -e s+$vimloc/vimrc+$vimrcloc/vimrc+ \
55 -e s+$vimloc/gvimrc+$vimrcloc/gvimrc+ \
56 -e s+$vimloc/menu.vim+$scriptloc/menu.vim+ \
57 -e s+$vimloc/bugreport.vim+$scriptloc/bugreport.vim+ \
58 -e s+$vimloc/filetype.vim+$scriptloc/filetype.vim+ \
Bram Moolenaarb5bf5b82004-12-24 14:35:23 +000059 -e s+$vimloc/scripts.vim+$scriptloc/scripts.vim+ \
60 -e s+$vimloc/optwin.vim+$scriptloc/optwin.vim+ \
61 -e 's+$vimloc/\*.ps+$scriptloc/\*.ps+' \
62 $helpsource/vim$langadd.1 > $destdir/$exename.1
63 chmod $manmod $destdir/$exename.1
64
65 # vimtutor.1
66 echo installing $destdir/$exename""tutor.1
67 sed -e s+/usr/local/lib/vim+$vimloc+ \
68 -e s+$vimloc/tutor+$tutorsubloc+ \
69 $helpsource/vimtutor$langadd.1 > $destdir/$exename""tutor.1
70 chmod $manmod $destdir/$exename""tutor.1
71
72 # vimdiff.1
73 echo installing $destdir/$vimdiffname.1
74 cp $helpsource/vimdiff$langadd.1 $destdir/$vimdiffname.1
75 chmod $manmod $destdir/$vimdiffname.1
76
77 # evim.1
78 echo installing $destdir/$evimname.1
79 sed -e s+/usr/local/lib/vim+$vimloc+ \
Bram Moolenaare37d50a2008-08-06 17:06:04 +000080 -e s+$vimloc/evim.vim+$scriptloc/evim.vim+ \
Bram Moolenaarb5bf5b82004-12-24 14:35:23 +000081 $helpsource/evim$langadd.1 > $destdir/$evimname.1
82 chmod $manmod $destdir/$evimname.1
83fi
84
85if test $what = "uninstall"; then
86 echo Checking for Vim manual pages in $destdir...
87 if test -r $destdir/$exename.1; then
88 echo deleting $destdir/$exename.1
89 rm -f $destdir/$exename.1
90 fi
91 if test -r $destdir/$exename""tutor.1; then
92 echo deleting $destdir/$exename""tutor.1
93 rm -f $destdir/$exename""tutor.1
94 fi
95 if test -r $destdir/$vimdiffname.1; then
96 echo deleting $destdir/$vimdiffname.1
97 rm -f $destdir/$vimdiffname.1
98 fi
99 if test -r $destdir/$evimname.1; then
100 echo deleting $destdir/$evimname.1
101 rm -f $destdir/$evimname.1
102 fi
103fi
104
105if test $what = "xxd"; then
106 echo installing $destdir/xxd.1
107 cp $helpsource/xxd$langadd.1 $destdir/xxd.1
108 chmod $manmod $destdir/xxd.1
109fi
110
111exit $errstatus
112
Bram Moolenaar11cbeb12005-03-11 22:51:16 +0000113# vim: set sw=3 sts=3 :