r679 - in /trunk/packages/vim/debian: changelog rules vim-variant.preinst

jamessan at users.alioth.debian.org jamessan at users.alioth.debian.org
Wed May 17 02:04:26 UTC 2006


Author: jamessan
Date: Wed May 17 02:04:23 2006
New Revision: 679

URL: http://svn.debian.org/wsvn/pkg-vim/?sc=1&rev=679
Log:
Add preinst file to remove any alternatives that weren't removed by earlier prerm scripts.

Added:
    trunk/packages/vim/debian/vim-variant.preinst
Modified:
    trunk/packages/vim/debian/changelog
    trunk/packages/vim/debian/rules

Modified: trunk/packages/vim/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim/debian/changelog?rev=679&op=diff
==============================================================================
--- trunk/packages/vim/debian/changelog (original)
+++ trunk/packages/vim/debian/changelog Wed May 17 02:04:23 2006
@@ -6,6 +6,8 @@
   [ James Vega ]
   * Update debian/vim-variant.prerm to also remove alternative during
     upgrades.
+  * Add debian/vim-variant.preinst to cleanup alternatives left behind from
+    previous vim-variant.prerm scripts.
 
  -- James Vega <jamessan at debian.org>  Tue, 16 May 2006 14:07:14 -0400
 

Modified: trunk/packages/vim/debian/rules
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim/debian/rules?rev=679&op=diff
==============================================================================
--- trunk/packages/vim/debian/rules (original)
+++ trunk/packages/vim/debian/rules Wed May 17 02:04:23 2006
@@ -171,7 +171,7 @@
 EXTRA_TARBALL=$(NAME)-$(VERSION)-extra.tar.gz
 SOURCES = $(MAIN_TARBALL) $(LANG_TARBALL) $(EXTRA_TARBALL)
 BASE_URL=ftp://ftp.vim.org/pub/vim
-PER_VARIANT_FILES = install postinst postrm prerm links
+PER_VARIANT_FILES = install postinst postrm prerm preinst links
 LANGS += fr fr.ISO8859-1 fr.UTF-8
 LANGS += it it.ISO8859-1 it.UTF-8
 LANGS += pl pl.ISO8859-2 pl.UTF-8

Added: trunk/packages/vim/debian/vim-variant.preinst
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim/debian/vim-variant.preinst?rev=679&op=file
==============================================================================
--- trunk/packages/vim/debian/vim-variant.preinst (added)
+++ trunk/packages/vim/debian/vim-variant.preinst Wed May 17 02:04:23 2006
@@ -1,0 +1,47 @@
+#!/bin/bash -e
+
+pkg=@PKG@
+variant=@VARIANT@
+
+# Need this script to ensure a clean upgrade from pacakges that didn't remove
+# alternatives in prerm
+
+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_variant_alternative () {
+  for i in vi view ex editor rvim rview vimdiff vim; do
+    check_and_remove_alternative $i
+  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
+  done
+}
+
+case "$1" in
+  upgrade)
+    case "$pkg" in
+      vim-gnome|vim-full) # gnome enabled variants
+        check_and_remove_alternative gnome-text-editor
+	;;
+    esac
+    remove_variant_alternative
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0




More information about the pkg-vim-maintainers mailing list