OpenSuse - Installing Microsoft Fonts: различия между версиями

Материал из AlexNook
Перейти к навигацииПерейти к поиску
Строка 24: Строка 24:


FONTS=" \
FONTS=" \
dl.sourceforge.net/project/corefonts/the%20fonts/final/andale32.exe
dl.sourceforge.net/project/corefonts/the%20fonts/final/andale32.exe \
dl.sourceforge.net/project/corefonts/the%20fonts/final/andale32.exe \
dl.sourceforge.net/project/corefonts/the%20fonts/final/andale32.exe \
dl.sourceforge.net/project/corefonts/the%20fonts/final/arial32.exe  \
dl.sourceforge.net/project/corefonts/the%20fonts/final/arial32.exe  \
Строка 180: Строка 180:
</syntaxhighlight>
</syntaxhighlight>
}}
}}


==Ссылки==
==Ссылки==
* [http://www.freetechie.com/blog/installing-microsoft-fonts-on-opensuse-110/ Стаья], которая стала основой данного материала.
* [http://www.freetechie.com/blog/installing-microsoft-fonts-on-opensuse-110/ Стаья], которая стала основой данного материала.

Версия 12:30, 19 марта 2011

Установка шрифтов от MS на openSuse.

Весь материал взял вот по этой ссылке. Лучше пользоваться ей, возможно там будут вносится некие изменения в будущем. Я лишь тут сохраню то, что есть там, на случай если тот сайт вдруг упадёт.

Установка

Сперва надо установить CabExtract

zypper in cabextract

Затем скачать нужный скрипт, который и выполнит всю работу:

wget http://www.freetechie.com/upload/font/fetchmsttfonts.sh

Даём права на выполнение скрипту

chmod a+x fetchmsttfonts.sh

Запускаем скриптик

sh fetchmsttfonts.sh

Код скрипта fetchmsttfonts.sh

File: fetchmsttfonts.sh
#!/bin/sh

EULA="http://corefonts.sourceforge.net/eula.htm"

FONTS=" \
dl.sourceforge.net/project/corefonts/the%20fonts/final/andale32.exe \
dl.sourceforge.net/project/corefonts/the%20fonts/final/andale32.exe \
dl.sourceforge.net/project/corefonts/the%20fonts/final/arial32.exe  \
dl.sourceforge.net/project/corefonts/the%20fonts/final/arialb32.exe \
dl.sourceforge.net/project/corefonts/the%20fonts/final/comic32.exe  \
dl.sourceforge.net/project/corefonts/the%20fonts/final/courie32.exe \
dl.sourceforge.net/project/corefonts/the%20fonts/final/georgi32.exe \
dl.sourceforge.net/project/corefonts/the%20fonts/final/impact32.exe \
dl.sourceforge.net/project/corefonts/the%20fonts/final/times32.exe  \
dl.sourceforge.net/project/corefonts/the%20fonts/final/trebuc32.exe \
dl.sourceforge.net/project/corefonts/the%20fonts/final/verdan32.exe \
dl.sourceforge.net/project/corefonts/the%20fonts/final/webdin32.exe \
"

SERVER=" \
jaist    \
voxel	 \
heanet   \
kent     \
nchc     \
easynews \
waix     \
internode \
internap \
"

CURL_OPTIONS="-s --speed-limit 3500 --speed-time 15"

if [ ! -f /usr/bin/id -o ! -f /usr/bin/cabextract -o ! -f /usr/sbin/fonts-config ]; then
 echo "Running in non-chrooted (install into directory) mode... Exit safely."
 exit 0
fi

if [ "`id -u`" != "0" ]; then
 echo "error: You must be root to use this program!"
 exit 1
fi

if [ ! -x /usr/bin/cabextract ]; then
  echo "error: cabextract missing! Please install package cabextract first."
  exit 2
fi

. /etc/sysconfig/proxy

if test "$PROXY_ENABLED" != "no"; then
  if test -n "$HTTP_PROXY" ; then
    export http_proxy="$HTTP_PROXY"
  fi
fi

if [ -z $http_proxy ]; then
  echo 
  echo "note: No proxy is used. Please set the environment variable \"http_proxy\""
  echo "note: to your favorite proxy, if you want to use a proxy for the download."
  echo "note:"
  echo "note:   bash: export http_proxy=\"http://proxy.example.com:3128/\""
  echo "note:   tcsh: setenv http_proxy \"http://proxy.example.com:3128/\""
fi

echo "EULA:"
mkdir -p /usr/share/doc/corefonts
echo -n "  Fetching   ... "
curl $CURL_OPTIONS -o /usr/share/doc/corefonts/EULA.html $EULA || \
  rm -f /usr/share/doc/corefonts/EULA.html
echo "done"

tmpname=`basename $0`
tmpdir=`mktemp -d /tmp/$tmpname.XXXXXX`
trap "rm -rf $tmpdir" EXIT
if [ $? -ne 0 ]; then
  echo "$0: Can't create temp dir, exiting..."
  exit 4
fi

pushd $tmpdir &> /dev/null

echo
echo "Trying to find the fastest server:"
besttime=1000

for server in $SERVER; do
  echo -n " $server ... "
  start=$SECONDS
  curl $CURL_OPTIONS --connect-timeout 10 -o cabextract.rpm \
    http://$server.dl.sourceforge.net/project/corefonts/cabextract/0.5/cabextract-0.5-1.i386.rpm
  if [ $? -ne 0 ]; then
    echo "too slow (aborted)"
    continue
  fi
  stop=$SECONDS
  time=$((stop - start))
  echo "$time sec"
  if [ $time -lt $besttime ]; then 
    besttime=$time
    useserver=$server
  fi
done

rm -f cabextract.rpm
if [ -n "$useserver" ]; then
  echo "The winner is: >> $useserver <<"
  echo
else
  echo "Connection too slow or no server available. Aborting ... "
  exit 5
fi

for font in $FONTS; do
 for i in $useserver $SERVER; do
  archive=http://$i.$font
  file=`echo $archive|awk -F "/" '{print $NF}'`
  rm -f $file
  echo "$file ($archive):"
  echo -n "  Fetching   ... "
  curl $CURL_OPTIONS -o $file $archive
  if [ $? -ne 0 ]; then
    rm -f $file
    echo "failed ... deleted!"
    continue
  fi
  echo done
  echo -n "  Extracting ... "
  cabextract -l $file &> /dev/null
  if [ $? -ne 0 ]; then
    rm -f $file
    echo "failed ... deleted!"
  else
    cabextract $file &> /dev/null
    echo "done"
    success=true
    break
  fi
  rm -f $file
 done
done

if [ "x$success" != "x" ]; then 
  for i in *.[Tt][Tt][CFcf]; do
    lower=`echo $i|tr [:upper:] [:lower:]`
    test "$i" != "$lower" && mv $i $lower
  done
  chmod 644 *.tt[cf]
  # impact.ttf already in agfa-fonts package
  test -s /usr/share/fonts/truetype/impact.ttf && rm impact.ttf
  mv -f *.tt[cf] /usr/share/fonts/truetype
  /usr/sbin/fonts-config
  echo "*** Fonts installed. ***"
else
  echo "*** No Fonts installed. ***"
fi

popd &> /dev/null

Ссылки

  • Стаья, которая стала основой данного материала.