[26331] in Source-Commits

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

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

daemon@ATHENA.MIT.EDU (Jonathan Reed)
Tue May 29 10:09:40 2012

Mime-Version: 1.0 (Apple Message framework v1084)
Content-Type: text/plain; charset=us-ascii
From: Jonathan Reed <jdreed@MIT.EDU>
In-Reply-To: <alpine.DEB.2.00.1205290237140.21310@dr-wily.mit.edu>
Date: Tue, 29 May 2012 10:09:35 -0400
Cc: source-commits@MIT.EDU
Message-Id: <C8864EF0-890D-4CBA-8A78-A12DACA7A57C@mit.edu>
To: Geoffrey Thomas <geofft@MIT.EDU>
Content-Transfer-Encoding: 8bit

Looking at a package built with 4.12, it looks like all the necessary bash crap is there at the top of the postinst, and I could just call check_undivert_unlink() ?   Is that a good idea?   I kind of want cpd-maintscript-helper(1).

-Jon


On May 29, 2012, at 5:47 AM, Geoffrey Thomas wrote:

> Sigh. I was gonna say "I thought we didn't need the pile of bash copypasta since c-p-d 4.12", but since it's cleanup from a mismanaged transition, I guess we actually do?
> 
> -- 
> Geoffrey Thomas
> geofft@mit.edu
> 
> On Mon, 28 May 2012, Jonathan D Reed wrote:
> 
>> 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