[26329] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r25520 - trunk/athena/lib/firefox-extension/debian

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Mon May 28 12:17:05 2012

Date: Mon, 28 May 2012 12:17:01 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201205281617.q4SGH1Na010768@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2012-05-28 12:17:01 -0400 (Mon, 28 May 2012)
New Revision: 25520

Modified:
   trunk/athena/lib/firefox-extension/debian/changelog
   trunk/athena/lib/firefox-extension/debian/debathena-firefox-extension.postinst
Log:
In firefox-extension:
  * Clean up from when ubufox.js moved to /etc/xul-ext


Modified: trunk/athena/lib/firefox-extension/debian/changelog
===================================================================
--- trunk/athena/lib/firefox-extension/debian/changelog	2012-05-25 22:30:06 UTC (rev 25519)
+++ trunk/athena/lib/firefox-extension/debian/changelog	2012-05-28 16:17:01 UTC (rev 25520)
@@ -5,8 +5,9 @@
     worked since Firefox 3.x
   * Switch to XPCOMUtils.jsm for the XPCOM scaffolding (break
     compatibility with Firefox 2 and earlier)
+  * Clean up from when ubufox.js moved to /etc/xul-ext
 
- -- Jonathan Reed <jdreed@mit.edu>  Fri, 25 May 2012 17:07:03 -0400
+ -- Jonathan Reed <jdreed@mit.edu>  Mon, 28 May 2012 12:03:40 -0400
 
 debathena-firefox-extension (10.0.7-0debathena5) unstable; urgency=low
 

Modified: trunk/athena/lib/firefox-extension/debian/debathena-firefox-extension.postinst
===================================================================
--- trunk/athena/lib/firefox-extension/debian/debathena-firefox-extension.postinst	2012-05-25 22:30:06 UTC (rev 25519)
+++ trunk/athena/lib/firefox-extension/debian/debathena-firefox-extension.postinst	2012-05-28 16:17:01 UTC (rev 25520)
@@ -17,9 +17,82 @@
 # for details, see http://www.debian.org/doc/debian-policy/ or
 # the debian-policy package
 
+package=debathena-firefox-extension
+ours=.debathena
+theirs=.debathena-orig
 
+undivert_unlink_symlink()
+{
+    file="$1"
+    ourfile="$2"
+    theirfile="$3"
+    if [ ! -L "$file" ] || \
+        [ "$(readlink "$file")" != "$(basename "$ourfile")" -a \
+          "$(readlink "$file")" != "$(basename "$theirfile")" ]; then
+        echo "*** OMINOUS WARNING ***: $file is not linked to either $(basename "$ourfile") or $(basename "$theirfile")" >&2
+    else
+        rm -f "$file"
+    fi
+}
+
+undivert_unlink_divert()
+{
+    file="$1"
+    if [ ! -L "$file" ] && [ ! -e "$file" ]; then
+        dpkg-divert --remove --rename --package "$package" "$file"
+    else
+        echo "Not removing diversion of $file by $package" >&2
+    fi
+}
+
+undivert_unlink()
+{
+    prefix=$1
+    suffix=$2
+
+    file=$prefix$suffix
+    ourfile=$prefix$ours$suffix
+    theirfile=$prefix$theirs$suffix
+
+    undivert_unlink_symlink "$file" "$ourfile" "$theirfile"
+    undivert_unlink_divert "$file" "$package"
+}
+
+cleanup_old_diversion() {
+    file="$1"
+    if dpkg-divert --list "${file}" | grep -Fxq "diversion of ${file} to ${file}${theirs} by ${package}"; then
+        undivert_unlink "$file"
+    fi
+}
+
 case "$1" in
     configure)
+	# In 0.9~rc2-0ubuntu2, the conffile moved to /etc/xul-ext
+	# and we horribly broke things.  Let's attempt to unbreak them:
+	ubufox_version="$(dpkg-query -W -f '${Version}' ubufox)"
+	if dpkg --compare-versions "$ubufox_version" ge "0.9~rc2-0ubuntu2"; then
+	    cleanup_old_diversion /etc/firefox-3.0/pref/ubufox.js
+	    echo "*** The previous OMINOUS WARNING may be safely ignored ***" >&2
+	    # If there are files in the location, move them to
+	    # the new location, unless the user has already done that
+	    # and that will restore any broken symlinks.
+	    for f in $(ls /etc/firefox-3.0/pref/ubufox.js.debathena*); do
+		mv -u "$f" /etc/xul-ext
+	    fi
+	    new_file=/etc/xul-ext/ubufox.js
+	    if [ -L "$new_file" ] && 
+	       [ ! -e "$(readlink -f "$new_file")" ]; then
+		# If the link target is still missing, copy over upstream's
+		# new config file, or upstream's old config file, or give up
+		if [ -f /etc/xul-ext/ubufox.js.dpkg-new ]; then
+		    mv -f /etc/xul-ext/ubufox.js.dpkg-new /etc/xul-ext/ubufox.js
+		elif [ -f /etc/xul-ext/ubufox.js.debathena-orig ]; then
+		    mv -f /etc/xul-ext/ubufox.js.debathena-orig /etc/xul-ext/ubufox.js
+		else
+		    echo "*** Manual inspection and cleanup of /etc/xul-ext/ubufox.js may be required"
+		fi
+	    fi
+	fi
 	if [ -d /usr/lib/firefox/extensions ] && ! [ -h /usr/lib/firefox/extensions ]; then
 	    ln -s /usr/lib/debathena-firefox-extension /usr/lib/firefox/extensions/athena@mit.edu
 	fi


home help back first fref pref prev next nref lref last post