Gbp-Pq: Name diff.patch
This commit is contained in:
Ubuntu Developers 2022-05-14 04:07:25 +08:00 committed by openKylinBot
parent c86814ec9d
commit be7158927c
1 changed files with 56 additions and 144 deletions

View File

@ -1,36 +1,21 @@
#!/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" >&2
echo "The fonts are NOT installed." >&2
@ -38,28 +23,33 @@ mstt_exit_with_error() {
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://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/"
db_get msttcorefonts/accepted-mscorefonts-eula || true
if [ "$RET" != "true" ]; then
mstt_exit_with_error "user did not accept the $license license"
fi
if [ "$URLOVERRIDE" ] ; then
URLROOTS="$URLOVERRIDE"
if [ -z "$QUIET_MODE" ] ; then
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
SCRATCHDIR=`mktemp -t -d ttf-mscorefonts-installer.XXXXXX`
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 <<EOF > msfonts.info
48d9bc613917709d3b0e0f4a6d4fe33a5c544c5035dffe9e90bc11e50e822071 Andale_Mono.ttf andale32.exe andalemo.ttf
dad7c04acb26e23dfe4780e79375ca193ddaf68409317e81577a30674668830e Arial_Black.ttf arialb32.exe ariblk.ttf
@ -93,121 +83,45 @@ c8f5065ba91680f596af3b0378e2c3e713b95a523be3d56ae185ca2b8f5f0b23 Verdana_Bold.tt
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
for ff in "$@"; do
cabextract $ff 1>&2 || EXITCODE=1
#rm $ff
done
#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
FFDONE=""
FFFAILED=""
if [ -n "$CHECK_ONLY" ] ; then
if [ -n "$FONTFILES" ] ; then
EXITCODE=1
fi
elif [ -n "$FONTFILES" ] ; then
chmod 644 *
if [ -z "$QUIET_MODE" ] ; then
cat <<EOF
# Give sane names. These are nearly the same names MS uses for the
# Macintosh versions
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
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
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
:> /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 /
rm -rf $SCRATCHDIR
@ -223,6 +137,4 @@ if [ -z "$QUIETMODE" ] ; then
fi
fi
#DEBHELPER#
exit $EXITCODE