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 58 59 60
|
#!/bin/bash -e
pkg=@PKG@
variant=@VARIANT@
# two things to do:
# 1) remove /usr/bin/vim.variant as alternative for /usr/bin/vim
# 2) remove /usr/bin/gvim as an alternative for gnome-text-editor for
# variants built with gnome support
# check_and_remove_alternative cleans up stale alternatives that were left
# behind from previous mishandling of alternatives.
check_and_remove_alternative () {
if update-alternatives --list $1 | grep -q bin/vim; then
for f in `update-alternatives --list $1 | grep 'bin/vim$'`; do
update-alternatives --remove $1 $f
done
fi
}
remove_gnome_alternative () {
if [ -f /usr/bin/vim.$variant ]; then
check_and_remove_alternative gnome-text-editor
update-alternatives --remove gnome-text-editor /usr/bin/vim.$variant
fi
}
remove_variant_alternative () {
for i in vi view ex editor rvim rview vimdiff vim; do
check_and_remove_alternative $i
update-alternatives --remove $i /usr/bin/vim.$variant
done
case "$variant" in
gtk|lesstif|perl|python|ruby|tcl|gnome|full) # gui enabled variants
remove_gui_variant_alternative
;;
esac
}
remove_gui_variant_alternative () {
for i in eview evim gview gvimdiff rgview rgvim gvim; do
check_and_remove_alternative $i
update-alternatives --remove $i /usr/bin/vim.$variant
done
}
case "$1" in
remove)
case "$pkg" in
vim-gnome|vim-full) # gnome enabled variants
remove_gnome_alternative
;;
esac
remove_variant_alternative
;;
esac
#DEBHELPER#
exit 0
|