Comment 2 for bug 1022891

Siggi Langauf (s-langauf) wrote :

Okay, as this is a real showstopper here, I've just forked the package locally and applied the following changes to fix the issue:

First, I added a little snippet to postinst in order to pull in the override URL from debconf:

diff -u msttcorefonts-3.4ubuntu3/debian/postinst msttcorefonts-hotfix/debian/postinst.in
--- msttcorefonts-3.4ubuntu3/debian/postinst 2012-04-07 22:49:32.000000000 +0200
+++ msttcorefonts-hotfix/debian/postinst.in 2012-08-24 14:49:45.000000000 +0200
@@ -6,10 +6,21 @@
 db_get msttcorefonts/dldir
 LOCALCOPY=$RET

-# FIXME: we don't have a way to use an alternate download source here.
+URLROOT=#URLROOT#
 db_get msttcorefonts/dlurl
 URLOVERRIDE=$RET

+if test -n "$URLOVERRIDE"; then
+ DLFILE=/usr/share/package-data-downloads/ttf-mscorefonts-installer
+ echo "substituting $URLOVERRIDE for corefonts download URL..."
+ SEARCH=$(echo "$URLROOT"|sed -e 's/\//\\\//g')
+ REPLACE=$(echo "$URLOVERRIDE"|sed -e 's/\//\\\//g')
+ sed -e "s/$SEARCH/$REPLACE/" <$DLFILE >$DLFILE.new \
+ && mv $DLFILE.new $DLFILE
+ echo "dlurl sed -e \"s/^Url: .*(\/[^/]+.exe)/Url: $REPLACE\1/\" <$DLFILE >$DLFILE.new"
+ cp $DLFILE /usr/local/ttf-mscorefonts-installer.dlfile
+fi
+
 stamp_file=/var/lib/update-notifier/package-data-downloads/ttf-mscorefonts-installer

 if dpkg --compare-versions "$2" lt-nl 3.4ubuntu3 \

As you may have noted, I had to rename "debian/postinst" to "debian/postinst.in" in order to be able to add the base URL from debian/rules during package build time. One could just repeat the URL in debian/postinst, which I found too error-prone. The following line in debian/rules generates postinst from postinst.in:

diff -u msttcorefonts-3.4ubuntu3/debian/rules msttcorefonts-hotfix/debian/rules
--- msttcorefonts-3.4ubuntu3/debian/rules 2012-04-09 07:05:54.000000000 +0200
+++ msttcorefonts-hotfix/debian/rules 2012-08-24 15:36:18.000000000 +0200
@@ -6,6 +6,7 @@
        dh $@

 override_dh_auto_install:
+ sed -e 's/#URLROOT#/'$$(echo $(URLROOT)|sed -e 's/\//\\\//g')'/' <debian/postinst.in >debian/postinst
        mkdir -p debian/tmp/usr/share/package-data-downloads
        while read sum file; do \
                echo "Url: $(URLROOT)$$file"; \

Hope that somebody picks this up soon...