summaryrefslogtreecommitdiffstats
path: root/debian/vim-variant.postinst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 13:18:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 13:18:04 +0000
commit519cbf08704063b930fa613235d4a598105a449a (patch)
tree426a5a2a33b5ea123678481edd7d59dcf7ff58e9 /debian/vim-variant.postinst
parentAdding upstream version 2:8.2.2434. (diff)
downloadvim-519cbf08704063b930fa613235d4a598105a449a.tar.xz
vim-519cbf08704063b930fa613235d4a598105a449a.zip
Adding debian version 2:8.2.2434-3+deb11u1.debian/2%8.2.2434-3+deb11u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/vim-variant.postinst')
-rw-r--r--debian/vim-variant.postinst57
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