1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
#!/bin/sh
# postinst script for ttf-mathematica4.1
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
if [ $1 = configure ]; then
. /usr/share/debconf/confmodule
SHA512SUM=/usr/bin/sha512sum
PDIR=/usr/share/mathematica-fonts
FONTDIR=/usr/share/fonts/truetype/mathematica
TYPE1DIR=/usr/share/fonts/type1/mathematica
do_download=1
do_settings=1
fl_success=0
# check if fonts are already installed
if $SHA512SUM -c --status $PDIR/sha512-ttf 2>/dev/null && \
$SHA512SUM -c --status $PDIR/sha512-t1 2>/dev/null; then
do_download=0
fi
if [ $do_download -eq 0 ]; then
echo "All fonts already exist so not downloading any fonts."
elif [ $do_download -eq 1 ]; then
# start download
db_get mathematica-fonts/http_proxy || true
http_proxy=$RET
export http_proxy
SHA512TGZ=$PDIR/sha512-tgz
URL="http://support.wolfram.com/technotes/"
FILE="MathematicaV7FontsLinux.tar.gz"
SCRATCHDIR=`mktemp -p /tmp -d mathematica.XXXXXX`
chmod 0755 $SCRATCHDIR
cd $SCRATCHDIR
if [ -n "$QUIET_MODE" ] ; then
QUIET_ARG="--quiet"
else
QUIET_ARG=""
fi
HOME=`mktemp -p /tmp -d home.XXXXXX`
export HOME
if ! wget --continue --tries=1 --dns-timeout=10 --connect-timeout=5 --read-timeout=300 $QUIET_ARG --directory-prefix . --no-directories --no-background $URL$FILE ; then
echo "Download seems to fail."
fi
# check downloaded file
echo checking $FILE
if [ ! -f $FILE ] || ! $SHA512SUM -c --status $SHA512TGZ; then
echo "Downloaded file looks corrupted!"
echo "The fonts might be removed on the Web and if so we can do nothing, sorry."
echo ""
do_settings=0
else
echo "Downloaded successfully."
echo ""
fi
# start installation
if [ $do_settings -eq 1 ]; then
tar zxf $FILE 1>&2
rm $FILE
# chmod 644 ./Fonts/TTF/* ./Fonts/AFM/* ./Fonts/Type1/*
mkdir -p $FONTDIR $TYPE1DIR
mv ./Fonts/TTF/*.ttf $FONTDIR
mv ./Fonts/AFM/* ./Fonts/Type1/* $TYPE1DIR
cd /
rm -rf $SCRATCHDIR
if [ -z "$QUIETMODE" ] ; then
if $SHA512SUM -c --status $PDIR/sha512-ttf && \
$SHA512SUM -c --status $PDIR/sha512-t1; then
fl_success=1
fi
if [ $fl_success -eq 1 ]; then
echo "All fonts are downloaded and installed successfully."
echo ""
else
echo "Installation seems failed by unknown reason."
echo ""
fi
fi
else
rm -rf $SCRATCHDIR $HOME
fi # end of "do_settings=1"
fi # end of "do_download=1"
fi # end of if configure
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
|