parent
c86814ec9d
commit
be7158927c
200
update-ms-fonts
200
update-ms-fonts
|
@ -1,36 +1,21 @@
|
||||||
#!/bin/sh
|
#!/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
|
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
|
#for opt in "$@"; do
|
||||||
# case "$opt" in
|
# case "$opt" in
|
||||||
# -q) QUIET_MODE=1 ;;
|
# -q) QUIET_MODE=1 ;;
|
||||||
# -c) CHECK_ONLY=1 ;;
|
|
||||||
# -s*) SAVEDIR=${opt#-s} ;;
|
|
||||||
# -u*) URLOVERRIDE=${opt#-u} ;;
|
# -u*) URLOVERRIDE=${opt#-u} ;;
|
||||||
# *) LOCALCOPY=$opt ;;
|
# *) LOCALCOPY=$opt ;;
|
||||||
# esac
|
# esac
|
||||||
#done
|
#done
|
||||||
if [ "`echo $LOCALCOPY | tr '[:upper:]' '[:lower:]'`" = "none" ] ; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
EXITCODE=0
|
EXITCODE=0
|
||||||
|
|
||||||
export http_proxy
|
|
||||||
|
|
||||||
mstt_exit_with_error() {
|
mstt_exit_with_error() {
|
||||||
echo "$1" >&2
|
echo "$1" >&2
|
||||||
echo "The fonts are NOT installed." >&2
|
echo "The fonts are NOT installed." >&2
|
||||||
|
@ -38,28 +23,33 @@ mstt_exit_with_error() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Base URL for Microsoft fonts
|
db_get msttcorefonts/accepted-mscorefonts-eula || true
|
||||||
# Can be more than one to try, but here we just use SF.net's redirection,
|
if [ "$RET" != "true" ]; then
|
||||||
# which will work in most cases. The others serve as fallbacks to retry.
|
mstt_exit_with_error "user did not accept the $license license"
|
||||||
URLROOTS="http://downloads.sourceforge.net/corefonts/
|
fi
|
||||||
http://switch.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/"
|
|
||||||
|
|
||||||
if [ "$URLOVERRIDE" ] ; then
|
if [ -z "$QUIET_MODE" ] ; then
|
||||||
URLROOTS="$URLOVERRIDE"
|
cat <<EOF
|
||||||
|
|
||||||
|
These fonts were provided by Microsoft "in the interest of cross-
|
||||||
|
platform compatibility". This is no longer the case, but they are
|
||||||
|
still available from third parties.
|
||||||
|
|
||||||
|
You are free to download these fonts and use them for your own use,
|
||||||
|
but you may not redistribute them in modified form, including changes
|
||||||
|
to the file name or packaging format.
|
||||||
|
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SCRATCHDIR=`mktemp -t -d ttf-mscorefonts-installer.XXXXXX`
|
SCRATCHDIR=`mktemp -t -d ttf-mscorefonts-installer.XXXXXX`
|
||||||
chmod 0755 $SCRATCHDIR
|
chmod 0755 $SCRATCHDIR
|
||||||
cd $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 <<EOF > msfonts.info
|
cat <<EOF > msfonts.info
|
||||||
48d9bc613917709d3b0e0f4a6d4fe33a5c544c5035dffe9e90bc11e50e822071 Andale_Mono.ttf andale32.exe andalemo.ttf
|
48d9bc613917709d3b0e0f4a6d4fe33a5c544c5035dffe9e90bc11e50e822071 Andale_Mono.ttf andale32.exe andalemo.ttf
|
||||||
dad7c04acb26e23dfe4780e79375ca193ddaf68409317e81577a30674668830e Arial_Black.ttf arialb32.exe ariblk.ttf
|
dad7c04acb26e23dfe4780e79375ca193ddaf68409317e81577a30674668830e Arial_Black.ttf arialb32.exe ariblk.ttf
|
||||||
|
@ -93,121 +83,45 @@ c8f5065ba91680f596af3b0378e2c3e713b95a523be3d56ae185ca2b8f5f0b23 Verdana_Bold.tt
|
||||||
10d099c88521b1b9e380b7690cbe47b54bb19396ca515358cfdc15ac249e2f5d Webdings.ttf webdin32.exe webdings.ttf
|
10d099c88521b1b9e380b7690cbe47b54bb19396ca515358cfdc15ac249e2f5d Webdings.ttf webdin32.exe webdings.ttf
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
for ttf in `awk '{print $2}' msfonts.info` ; do
|
for ff in "$@"; do
|
||||||
if [ ! -e $FONTDIR/$ttf ] || \
|
cabextract $ff 1>&2 || EXITCODE=1
|
||||||
[ `sha256sum $FONTDIR/$ttf | awk '{print $1}'` != `awk "/$ttf/ {print \\$1 }" msfonts.info` ]
|
#rm $ff
|
||||||
then
|
done
|
||||||
THISFILE=`grep $ttf msfonts.info | awk '{print $3}'`
|
|
||||||
if ! echo $FONTFILES | grep -q $THISFILE ; then
|
#Add some level of predictability by folding everything to lower case
|
||||||
FONTFILES="$FONTFILES $THISFILE"
|
for x in *; do
|
||||||
fi
|
y=`echo $x | tr '[A-Z]' '[a-z]'`
|
||||||
|
if [ "$x" != "$y" ]; then
|
||||||
|
mv "$x" "$y"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
FFDONE=""
|
chmod 644 *
|
||||||
FFFAILED=""
|
|
||||||
if [ -n "$CHECK_ONLY" ] ; then
|
|
||||||
if [ -n "$FONTFILES" ] ; then
|
|
||||||
EXITCODE=1
|
|
||||||
fi
|
|
||||||
elif [ -n "$FONTFILES" ] ; then
|
|
||||||
|
|
||||||
if [ -z "$QUIET_MODE" ] ; then
|
# Give sane names. These are nearly the same names MS uses for the
|
||||||
cat <<EOF
|
# Macintosh versions
|
||||||
|
|
||||||
These fonts were provided by Microsoft "in the interest of cross-
|
mkdir -p /usr/share/doc/ttf-mscorefonts-installer $FONTDIR
|
||||||
platform compatibility". This is no longer the case, but they are
|
if [ -e licen.txt ] ; then
|
||||||
still available from third parties.
|
mv licen.txt '/usr/share/doc/ttf-mscorefonts-installer/READ_ME!'
|
||||||
|
gzip -f -9 '/usr/share/doc/ttf-mscorefonts-installer/READ_ME!'
|
||||||
You are free to download these fonts and use them for your own use,
|
|
||||||
but you may not redistribute them in modified form, including changes
|
|
||||||
to the file name or packaging format.
|
|
||||||
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$QUIET_MODE" ] ; then
|
|
||||||
QUIET_ARG="--quiet"
|
|
||||||
else
|
|
||||||
QUIET_ARG=""
|
|
||||||
fi
|
|
||||||
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
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
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!'
|
|
||||||
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
|
fi
|
||||||
|
|
||||||
|
:> /var/lib/msttcorefonts/ms-fonts
|
||||||
|
|
||||||
|
awk "{ print \$4 \" \" \$2 }" msfonts.info | while read ttf longname
|
||||||
|
do
|
||||||
|
if ! mv $ttf $FONTDIR/$longname; then
|
||||||
|
FFFAILED="$FFFAILED $ttf"
|
||||||
|
EXITCODE=1
|
||||||
|
continue
|
||||||
|
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 /
|
cd /
|
||||||
rm -rf $SCRATCHDIR
|
rm -rf $SCRATCHDIR
|
||||||
|
|
||||||
|
@ -223,6 +137,4 @@ if [ -z "$QUIETMODE" ] ; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
exit $EXITCODE
|
exit $EXITCODE
|
||||||
|
|
Loading…
Reference in New Issue