summaryrefslogtreecommitdiffstats
path: root/debian/vim-variant.postinst
blob: de433d21a7347b3d8dae0e6f44a381365f3a0a9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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