summaryrefslogtreecommitdiffstats
path: root/debian/vim-runtime.preinst.in
blob: 9e5df5f59d06a5a6307bb8a0df2d81f9a8bc0566 (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
#!/bin/sh
set -e

vimcur="@VIMCUR@"
basedir=/usr/share/vim/$vimcur/doc

add_diversion() {
  dpkg-divert --package vim-runtime --add --rename \
    --divert "$1.vim-tiny" "$1"
}

major_upgrade() {
  oldver="${1#?:}"
  oldver="vim$(echo ${oldver%.*-*} | sed 's/\.//g')"
  [ "$oldver" != "$vimcur" ]
}

# Add diversions for any non-upgrade operation or when upgrading across major
# upstream versions.
if [ "$1" != "upgrade" ] || major_upgrade $2; then
  add_diversion $basedir/help.txt
  add_diversion $basedir/tags
fi

#DEBHELPER#

exit 0