diff -Nru msttcorefonts-3.4ubuntu2/debian/changelog msttcorefonts-3.4ubuntu3/debian/changelog --- msttcorefonts-3.4ubuntu2/debian/changelog 2012-02-13 13:05:48.000000000 +0000 +++ msttcorefonts-3.4ubuntu3/debian/changelog 2012-04-09 05:36:26.000000000 +0000 @@ -1,3 +1,13 @@ +msttcorefonts (3.4ubuntu3) precise; urgency=low + + * Migrate to use an update-notifier hook, so that package data can be + handled asynchronously and not cause install failures on network + problems. LP: #876298. + * Add missing pre-depends for use of debconf in preinst. + * Convert to dh(1). + + -- Steve Langasek Sun, 08 Apr 2012 22:36:25 -0700 + msttcorefonts (3.4ubuntu2) precise; urgency=low * Use maintscript support in dh_installdeb rather than writing out diff -Nru msttcorefonts-3.4ubuntu2/debian/config msttcorefonts-3.4ubuntu3/debian/config --- msttcorefonts-3.4ubuntu2/debian/config 2011-11-30 05:13:48.000000000 +0000 +++ msttcorefonts-3.4ubuntu3/debian/config 2012-04-07 03:37:06.000000000 +0000 @@ -68,11 +68,10 @@ done if [ -n "$NEEDUPDATE" ] ; then + rm -f /var/lib/update-notifier/package-data-downloads/ttf-mscorefonts-installer \ + /var/lib/update-notifier/package-data-downloads/ttf-mscorefonts-installer.* + db_input low msttcorefonts/dldir || true - if [ -n "$http_proxy" ] ; then - db_set msttcorefonts/http_proxy $http_proxy - fi - db_input medium msttcorefonts/http_proxy || true db_go db_get msttcorefonts/dldir @@ -98,11 +97,6 @@ break fi done - if [ -z "$RET" ]; then - db_input low msttcorefonts/savedir || true - db_go - db_get msttcorefonts/savedir - fi db_get msttcorefonts/dldir diff -Nru msttcorefonts-3.4ubuntu2/debian/control msttcorefonts-3.4ubuntu3/debian/control --- msttcorefonts-3.4ubuntu2/debian/control 2012-02-13 13:02:03.000000000 +0000 +++ msttcorefonts-3.4ubuntu3/debian/control 2012-04-07 03:39:16.000000000 +0000 @@ -10,8 +10,8 @@ Package: ttf-mscorefonts-installer Architecture: all -Pre-Depends: ${misc:Pre-Depends} -Depends: wget, cabextract, xfonts-utils, ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends}, debconf (>= 0.5) | debconf-2.0 +Depends: cabextract, xfonts-utils, update-notifier-common (>= 0.119ubuntu2), ${misc:Depends} Recommends: fonts-liberation Provides: msttcorefonts Multi-Arch: foreign diff -Nru msttcorefonts-3.4ubuntu2/debian/install msttcorefonts-3.4ubuntu3/debian/install --- msttcorefonts-3.4ubuntu2/debian/install 2011-11-30 05:13:48.000000000 +0000 +++ msttcorefonts-3.4ubuntu3/debian/install 2012-04-07 03:41:51.000000000 +0000 @@ -1 +1,2 @@ -cabfiles.sha256sums /var/lib/msttcorefonts +update-ms-fonts /usr/lib/msttcorefonts +usr/share/package-data-downloads diff -Nru msttcorefonts-3.4ubuntu2/debian/postinst msttcorefonts-3.4ubuntu3/debian/postinst --- msttcorefonts-3.4ubuntu2/debian/postinst 1970-01-01 00:00:00.000000000 +0000 +++ msttcorefonts-3.4ubuntu3/debian/postinst 2012-04-07 20:49:32.000000000 +0000 @@ -0,0 +1,48 @@ +#!/bin/sh +set -e + +. /usr/share/debconf/confmodule + +db_get msttcorefonts/dldir +LOCALCOPY=$RET + +# FIXME: we don't have a way to use an alternate download source here. +db_get msttcorefonts/dlurl +URLOVERRIDE=$RET + +stamp_file=/var/lib/update-notifier/package-data-downloads/ttf-mscorefonts-installer + +if dpkg --compare-versions "$2" lt-nl 3.4ubuntu3 \ + && [ -f /var/lib/msttcorefonts/ms-fonts ] +then + # don't force a redownload with the new hook + touch $stamp_file +fi + +# if the license was not accepted, ensure the fonts are removed +# and add README with helpful information + FONTDIR=/usr/share/fonts/truetype/msttcorefonts + mkdir -p $FONTDIR + license=mscorefonts-eula + db_get msttcorefonts/accepted-$license + if [ "$RET" != "true" ]; then + echo "user did not accept the $license license" >&2 + rm -f $FONTDIR/*.ttf + cat > $FONTDIR/README <&2 - rm -f $FONTDIR/*.ttf - cat > $FONTDIR/README <> debian/postinst - touch build-stamp -clean: - dh_testdir - dh_testroot - rm -f install-stamp debian/postinst build-stamp - dh_clean - -install: install-stamp -install-stamp: - dh_testdir - dh_testroot - dh_prep - dh_installdirs - dh_install - touch install-stamp - -# Build architecture-independent files here. -binary-indep: build install - dh_testdir - dh_testroot - dh_installdebconf - dh_installdocs - dh_installchangelogs - dh_lintian - dh_link - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -# Build architecture-dependent files here. -binary-arch: build install -# We have nothing to do by default. - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary +override_dh_auto_install: + mkdir -p debian/tmp/usr/share/package-data-downloads + while read sum file; do \ + echo "Url: $(URLROOT)$$file"; \ + echo "Sha256: $$sum"; \ + echo ; \ + done < cabfiles.sha256sums > debian/tmp/usr/share/package-data-downloads/ttf-mscorefonts-installer + echo "Script: /usr/lib/msttcorefonts/update-ms-fonts" >> debian/tmp/usr/share/package-data-downloads/ttf-mscorefonts-installer + echo "Should-Download: msttcorefonts/accepted-mscorefonts-eula" >> debian/tmp/usr/share/package-data-downloads/ttf-mscorefonts-installer diff -Nru msttcorefonts-3.4ubuntu2/debian/templates msttcorefonts-3.4ubuntu3/debian/templates --- msttcorefonts-3.4ubuntu2/debian/templates 2011-11-30 05:13:48.000000000 +0000 +++ msttcorefonts-3.4ubuntu3/debian/templates 2012-04-07 03:37:14.000000000 +0000 @@ -22,13 +22,6 @@ expected by this script. Please re-enter the directory containing the Microsoft font files or enter "none" to abort. -Template: msttcorefonts/savedir -Type: string -_Description: Where should these files be archived (optional): - If you would like to keep a permanent archive of the compressed Windows - self extracting files, enter the directory where you'd like them stored. - If you leave this blank, the files will be deleted after installation. - Template: msttcorefonts/dlurl Type: string _Description: Mirror to download from: @@ -38,15 +31,6 @@ to the directory containing the relevant files here. If not, just leave the field blank. -Template: msttcorefonts/http_proxy -Type: string -_Description: HTTP proxy to use: - If you need to use a proxy server, please enter it here (example: - http://192.168.0.1:8080). This will cause the font files to be - downloaded using your proxy. - . - Leave this option blank if you don't use a proxy server. - Template: msttcorefonts/present-mscorefonts-eula Type: note Description: TrueType core fonts for the Web EULA diff -Nru msttcorefonts-3.4ubuntu2/debian/ttf-mscorefonts-installer.lintian-overrides msttcorefonts-3.4ubuntu3/debian/ttf-mscorefonts-installer.lintian-overrides --- msttcorefonts-3.4ubuntu2/debian/ttf-mscorefonts-installer.lintian-overrides 2011-11-30 05:13:48.000000000 +0000 +++ msttcorefonts-3.4ubuntu3/debian/ttf-mscorefonts-installer.lintian-overrides 2012-04-07 03:53:43.000000000 +0000 @@ -1 +1,2 @@ ttf-mscorefonts-installer: package-contains-empty-directory usr/share/fonts/truetype/ +ttf-mscorefonts-installer: debconf-is-not-a-registry usr/lib/msttcorefonts/update-ms-fonts diff -Nru msttcorefonts-3.4ubuntu2/update-ms-fonts msttcorefonts-3.4ubuntu3/update-ms-fonts --- msttcorefonts-3.4ubuntu2/update-ms-fonts 2011-11-30 05:13:48.000000000 +0000 +++ msttcorefonts-3.4ubuntu3/update-ms-fonts 2012-04-07 04:06:25.000000000 +0000 @@ -1,61 +1,31 @@ #!/bin/sh -# Download and install the Microsoft Core Fonts for the Web -# -# (C) 2000,2001 Eric Sharkey. -# You may freely distribute this file under the terms of the GNU General -# Public License, version 2 or later. -#abort if anything goes wrong -#set -e +set -e + +. /usr/share/debconf/confmodule + FONTDIR=/usr/share/fonts/truetype/msttcorefonts -#if [ `id -u` != 0 ] ; then -# echo "update-ms-fonts can only be run as root." -# exit -1 -#fi -# #for opt in "$@"; do # case "$opt" in # -q) QUIET_MODE=1 ;; -# -c) CHECK_ONLY=1 ;; -# -s*) SAVEDIR=${opt#-s} ;; # -u*) URLOVERRIDE=${opt#-u} ;; # *) LOCALCOPY=$opt ;; # esac #done -if [ "`echo $LOCALCOPY | tr '[:upper:]' '[:lower:]'`" = "none" ] ; then - exit 0 -fi EXITCODE=0 -export http_proxy - mstt_exit_with_error() { - echo "$1" - echo "The fonts are NOT installed." - echo "Please run 'dpkg-reconfigure ttf-mscorefonts-installer' to perform the installation again" - exit 0 # still install the Debian package + echo "$1" >&2 + echo "The fonts are NOT installed." >&2 + echo "Please run 'dpkg-reconfigure ttf-mscorefonts-installer' to perform the installation again" >&2 + exit 1 } -# Base URL for Microsoft fonts -# Can be more than one to try, but here we just use SF.net's redirection, -# which will work in most cases. The others serve as fallbacks to retry. -URLROOTS="http://downloads.sourceforge.net/corefonts/ - http://switch.dl.sourceforge.net/sourceforge/corefonts/ - http://mesh.dl.sourceforge.net/sourceforge/corefonts/ - http://dfn.dl.sourceforge.net/sourceforge/corefonts/ - http://heanet.dl.sourceforge.net/sourceforge/corefonts/ - http://jaist.dl.sourceforge.net/sourceforge/corefonts/ - http://nchc.dl.sourceforge.net/sourceforge/corefonts/ - http://ufpr.dl.sourceforge.net/sourceforge/corefonts/ - http://internode.dl.sourceforge.net/sourceforge/corefonts/ - http://voxel.dl.sourceforge.net/sourceforge/corefonts/ - http://kent.dl.sourceforge.net/sourceforge/corefonts/ - http://internap.dl.sourceforge.net/sourceforge/corefonts/" - -if [ "$URLOVERRIDE" ] ; then - URLROOTS="$URLOVERRIDE" +db_get msttcorefonts/accepted-mscorefonts-eula || true +if [ "$RET" != "true" ]; then + mstt_exit_with_error "user did not accept the $license license" fi if [ -z "$QUIET_MODE" ] ; then @@ -76,6 +46,10 @@ chmod 0755 $SCRATCHDIR cd $SCRATCHDIR +# We only use the 2nd and 4th fields here (the sha256 checksumming is done on +# the .exe so we don't need the first field, and the filenames are dealt with +# by the downloader hook so we don't care what they are); but keep this intact +# so that we don't have painful merges in the future. cat < msfonts.info 48d9bc613917709d3b0e0f4a6d4fe33a5c544c5035dffe9e90bc11e50e822071 Andale_Mono.ttf andale32.exe andalemo.ttf dad7c04acb26e23dfe4780e79375ca193ddaf68409317e81577a30674668830e Arial_Black.ttf arialb32.exe ariblk.ttf @@ -109,117 +83,44 @@ 10d099c88521b1b9e380b7690cbe47b54bb19396ca515358cfdc15ac249e2f5d Webdings.ttf webdin32.exe webdings.ttf EOF -for ttf in `awk '{print $2}' msfonts.info` ; do - if [ ! -e $FONTDIR/$ttf ] || \ - [ `sha256sum $FONTDIR/$ttf | awk '{print $1}'` != `awk "/$ttf/ {print \\$1 }" msfonts.info` ] - then - THISFILE=`grep $ttf msfonts.info | awk '{print $3}'` - if ! echo $FONTFILES | grep -q $THISFILE ; then - FONTFILES="$FONTFILES $THISFILE" - fi - fi +for ff in "$@"; do + cabextract $ff 1>&2 || EXITCODE=1 + rm $ff done -FFDONE="" -FFFAILED="" -if [ -n "$CHECK_ONLY" ] ; then - if [ -n "$FONTFILES" ] ; then - EXITCODE=1 - fi -elif [ -n "$FONTFILES" ] ; then - if [ -n "$QUIET_MODE" ] ; then - QUIET_ARG="--quiet" - else - QUIET_ARG="" +#Add some level of predictability by folding everything to lower case +for x in *; do + y=`echo $x | tr '[A-Z]' '[a-z]'` + if [ "$x" != "$y" ]; then + mv "$x" "$y" fi +done - # use apt proxy - APT_PROXIES=$(apt-config shell \ - http_proxy Acquire::http::Proxy \ - https_proxy Acquire::https::Proxy \ - ftp_proxy Acquire::ftp::Proxy \ - ) +chmod 644 * - if [ -n "$APT_PROXIES" ]; then - eval export $APT_PROXIES - fi +# Give sane names. These are nearly the same names MS uses for the +# Macintosh versions - for ff in $FONTFILES; do - for URLROOT in $URLROOTS ; do - if [ ! -e $ff.done ] || [ ! -e $ff ] ; then - if [ -z "$LOCALCOPY" ] ; then - if ! wget --continue --tries=1 --connect-timeout=60 --read-timeout=300 $QUIET_ARG --directory-prefix . --no-directories --no-background --progress=dot:default $URLROOT$ff ; then - continue 1 - fi - else - cp $LOCALCOPY/$ff . - fi - touch $ff.done - break - fi - done - if [ -e "$ff" ]; then - FFDONE="$FFDONE $ff" - else - FFFAILED="$FFFAILED $ff" - EXITCODE=1 - fi - done - if [ -n "$SAVEDIR" ] ; then - mkdir -p "$SAVEDIR" - fi +mkdir -p /usr/share/doc/ttf-mscorefonts-installer $FONTDIR +if [ -e licen.txt ] ; then + mv licen.txt '/usr/share/doc/ttf-mscorefonts-installer/READ_ME!' + gzip -f -9 '/usr/share/doc/ttf-mscorefonts-installer/READ_ME!' +fi - # Reset counters for checksum - FONTFILES=$FFDONE - FFDONE="" - - for ff in $FONTFILES; do - # verify checksum before unpacking, to be safe - if grep "$ff\$" /var/lib/msttcorefonts/cabfiles.sha256sums | sha256sum -c ; then - cabextract $ff 1>&2 - FFDONE="$FFDONE $ff" - else - FFFAILED="$FFFAILED $ff" - EXITCODE=1 - fi - if [ -n "$SAVEDIR" ] ; then - cp $ff "$SAVEDIR" - fi - rm $ff - done +:> /var/lib/msttcorefonts/ms-fonts - FONTFILES=$FFDONE - FFDONE="" - #Add some level of predictability by folding everything to lower case - for x in *; do - y=`echo $x | tr '[A-Z]' '[a-z]'` - if [ "$x" != "$y" ]; then - mv "$x" "$y" - fi - done - - chmod 644 * - - # Give sane names. These are nearly the same names MS uses for the - # Macintosh versions - - mkdir -p /usr/share/doc/ttf-mscorefonts-installer $FONTDIR - if [ -e licen.txt ] ; then - mv licen.txt '/usr/share/doc/ttf-mscorefonts-installer/READ_ME!' - gzip -f -9 '/usr/share/doc/ttf-mscorefonts-installer/READ_ME!' +awk "{ print \$4 \" \" \$2 }" msfonts.info | while read ttf longname +do + if ! mv $ttf $FONTDIR/$longname; then + FFFAILED="$FFFAILED $ttf" + EXITCODE=1 + continue fi - for ff in $FONTFILES; do - for ttf in `grep $ff msfonts.info | awk '{print $4}'`; do - longname=`awk "/$ttf/ { print \\$2 }" msfonts.info` - mv $ttf $FONTDIR/$longname - ln -sf $longname $FONTDIR/$ttf - done - done - - # Make a note of what we installed so we can uninstall it later - awk '{print $2}' msfonts.info > /var/lib/msttcorefonts/ms-fonts - awk '{print $4}' msfonts.info >> /var/lib/msttcorefonts/ms-fonts -fi + ln -sf $longname $FONTDIR/$ttf + # Make a note of what we installed so we can uninstall it later + echo $longname >> /var/lib/msttcorefonts/ms-fonts + echo $ttf >> /var/lib/msttcorefonts/ms-fonts +done cd / rm -rf $SCRATCHDIR @@ -228,10 +129,12 @@ if [ $EXITCODE = 0 ] ; then echo "All fonts downloaded and installed." else - mstt_exit_with_error "The following fonts failed to install : $FFFAILED." + if [ -n "$FFFAILED" ]; then + mstt_exit_with_error "The following fonts failed to install : $FFFAILED." + else + mstt_exit_with_error "One or more fonts could not be extracted." + fi fi fi -#DEBHELPER# - -exit 0 +exit $EXITCODE