diff options
Diffstat (limited to 'debian/vim-variant.postinst')
-rw-r--r-- | debian/vim-variant.postinst | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/debian/vim-variant.postinst b/debian/vim-variant.postinst new file mode 100644 index 0000000..de433d2 --- /dev/null +++ b/debian/vim-variant.postinst @@ -0,0 +1,57 @@ +#!/bin/sh +set -e + +pkg=@PKG@ +variant=@VARIANT@ +mandir=/usr/share/man + +# add /usr/bin/vim.variant as alternative for /usr/bin/vim. Priority are +# chosen accordingly to the principle: ``more features, higher priority'' + +add_variant_alternative () { + if [ "$variant" != "tiny" ]; then + update-alternatives --install /usr/bin/vim vim /usr/bin/vim.$variant $1 + update-alternatives --install /usr/bin/vimdiff vimdiff /usr/bin/vim.$variant $1 + update-alternatives --install /usr/bin/rvim rvim /usr/bin/vim.$variant $1 + fi + update-alternatives --install /usr/bin/rview rview /usr/bin/vim.$variant $1 + # Since other packages provide these commands, we'll setup alternatives for + # their manpages, too. + for i in vi view ex editor ; do + update-alternatives \ + --install /usr/bin/$i $i /usr/bin/vim.$variant $1 \ + @LANG_ALTS@ + --slave $mandir/man1/$i.1.gz $i.1.gz \ + $mandir/man1/vim.1.gz + done + case "$variant" in + gtk|gtk3|athena) # gui enabled variants + add_gui_variant_alternative $1 + ;; + esac +} + +add_gui_variant_alternative () { + for i in gvim gview rgview rgvim evim eview gvimdiff ; do + update-alternatives --install /usr/bin/$i $i /usr/bin/vim.$variant $1 + done +} + +case "$pkg" in + vim-tiny) + add_variant_alternative 15 + ;; + vim) + add_variant_alternative 30 + ;; + vim-nox) + add_variant_alternative 40 + ;; + vim-gtk|vim-gtk3|vim-athena) + add_variant_alternative 50 + ;; +esac + +#DEBHELPER# + +exit 0 |