wok diff get-msttcorefonts/stuff/get-msttcorefonts @ rev 20641

Add SSL support to retawq (needed by man to browse linux.die.net)
author Lucas Levrel <llevrel@yahoo.fr>
date Fri Jan 11 09:19:11 2019 +0100 (2019-01-11)
parents 3fb94ab57a3c
children
line diff
     1.1 --- a/get-msttcorefonts/stuff/get-msttcorefonts	Fri Apr 23 04:59:47 2010 +0000
     1.2 +++ b/get-msttcorefonts/stuff/get-msttcorefonts	Fri Jan 11 09:19:11 2019 +0100
     1.3 @@ -1,168 +1,52 @@
     1.4  #!/bin/sh
     1.5  
     1.6 +. /lib/libtaz.sh
     1.7 +
     1.8  PACKAGE="msttcorefonts"
     1.9 -VERSION="2.0"
    1.10 +VERSION="3.0"
    1.11  CUR_DIR=$(pwd)
    1.12 -TEMP_DIR=/tmp/$PACKAGE-$VERSION
    1.13 -ROOT=
    1.14 +TEMP_DIR="$(mktemp -d)"
    1.15 +ROOT="$1"
    1.16  
    1.17  # Check if we are root
    1.18 -if test $(id -u) != 0 ; then
    1.19 -    echo -e "\nYou must be root to run `basename $0`."
    1.20 -    echo -e "Please type 'su' and root password to become super-user.\n"
    1.21 -    exit 1
    1.22 -fi
    1.23 +check_root
    1.24  
    1.25 -# Avoid reinstall
    1.26 -if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
    1.27 -    echo -e "\n$PACKAGE package is already installed.\n"
    1.28 -    exit 1
    1.29 -fi
    1.30 +fontdir="$TEMP_DIR/$PACKAGE-$VERSION/fs/usr/share/fonts/truetype/$PACKAGE"
    1.31 +mkdir -p "$fontdir"
    1.32 +cd "$fontdir"
    1.33  
    1.34 -# Create a TEMP_DIR
    1.35 -mkdir -p $TEMP_DIR/downloads
    1.36 -cd $TEMP_DIR/downloads
    1.37 -
    1.38 -# this is the sourceforge mirrorlist as of 2006-04-30. If someone spots changes
    1.39 -# over at sourcforge, feel free to email me and I'll update the list
    1.40 -mirrors="easynews+heanet+superb-west+internap+switch+ufpr+surfnet+umn+kent+mesh+superb-east+jaist"
    1.41 -mirror_count=12
    1.42 -
    1.43 -andale32_md5="cbdc2fdd7d2ed0832795e86a8b9ee19a  andale32.exe"
    1.44 -arial32_md5="9637df0e91703179f0723ec095a36cb5  arial32.exe"
    1.45 -arialb32_md5="c9089ae0c3b3d0d8c4b0a95979bb9ff0  arialb32.exe"
    1.46 -comic32_md5="2b30de40bb5e803a0452c7715fc835d1  comic32.exe"
    1.47 -courie32_md5="4e412c772294403ab62fb2d247d85c60  courie32.exe"
    1.48 -georgi32_md5="4d90016026e2da447593b41a8d8fa8bd  georgi32.exe"
    1.49 -impact32_md5="7907c7dd6684e9bade91cff82683d9d7  impact32.exe"
    1.50 -times32_md5="ed39c8ef91b9fb80f76f702568291bd5  times32.exe"
    1.51 -trebuc32_md5="0d7ea16cac6261f8513a061fbfcdb2b5  trebuc32.exe"
    1.52 -webdin32_md5="230a1d13a365b22815f502eb24d9149b  webdin32.exe"
    1.53 -verdan32_md5="12d2a75f8156e10607be1eaa8e8ef120  verdan32.exe"
    1.54 -wd97vwr32_md5="efa72d3ed0120a07326ce02f051e9b42  wd97vwr32.exe"
    1.55 -
    1.56 -download_files="andale32.exe arial32.exe arialb32.exe comic32.exe courie32.exe georgi32.exe impact32.exe times32.exe trebuc32.exe webdin32.exe verdan32.exe wd97vwr32.exe"
    1.57 -
    1.58 -failures=0
    1.59 -
    1.60 -set_mirror() {
    1.61 -	local r m
    1.62 -	r=`expr $RANDOM % $mirror_count + 1`
    1.63 -	m=`echo $mirrors |cut -d+ -f$r`
    1.64 -	mirror="http://${m}.dl.sourceforge.net/sourceforge/corefonts/"
    1.65 -}
    1.66 -
    1.67 -check_file() {
    1.68 -	matches=no
    1.69 -	if [ ! -r $1 ]
    1.70 -	then
    1.71 -		echo "$1 does not exist"
    1.72 -		return
    1.73 -	fi
    1.74 -	local variable_name=`basename $1 .exe`_md5
    1.75 -	local stored_checksum
    1.76 -	eval stored_checksum=\$$variable_name
    1.77 -	local computed_checksum=`md5sum $1`
    1.78 -	if [ "$stored_checksum" = "$computed_checksum" ]
    1.79 -	then
    1.80 -		matches=yes
    1.81 -	else
    1.82 -		rm $1
    1.83 -		matches=no
    1.84 -	fi
    1.85 -}
    1.86 -
    1.87 -download() {
    1.88 -	curl --retry 5 -H Pragma: -R -S -L -o "$2" $1$2
    1.89 -}
    1.90 -
    1.91 -# Download the file
    1.92 -set_mirror
    1.93 -
    1.94 -if [ ! -d /var/lib/tazpkg/installed/curl ]; then
    1.95 -    tazpkg get-install curl
    1.96 -fi
    1.97 -if [ ! -f /usr/bin/curl ]; then
    1.98 -    cd $CUR_DIR
    1.99 -    echo "Could not find curl. Exiting."
   1.100 -    exit
   1.101 -fi
   1.102 -
   1.103 -for f in $download_files
   1.104 -do
   1.105 -	check_file $f
   1.106 -	while [ $matches != yes ]
   1.107 -	do
   1.108 -		download $mirror $f
   1.109 -		check_file $f
   1.110 -		if [ $matches != yes ]
   1.111 -		then
   1.112 -			echo "failed to download $mirror$f"
   1.113 -			failures=`expr $failures + 1`
   1.114 -			if [ $failures -gt 5 ]
   1.115 -			then
   1.116 -				echo "failed to download too many times."
   1.117 -				exit
   1.118 -			fi
   1.119 -			set_mirror
   1.120 -		fi
   1.121 -	done
   1.122 +for filename in andale arial arialb comic courie georgi impact times trebuc verdan webdin wd97vwr; do
   1.123 +	busybox wget "http://downloads.sourceforge.net/corefonts/${filename}32.exe"
   1.124 +	cabextract -L ${filename}32.exe
   1.125 +	find "$fontdir" -type f -name '*.cab' -exec cabextract -L \{\} \;
   1.126 +	find "$fontdir" -type f ! -name '*.ttf' -delete
   1.127  done
   1.128  
   1.129 -# Extract fonts
   1.130 -if [ ! -d /var/lib/tazpkg/installed/cabextract ]; then
   1.131 -    tazpkg get-install cabextract
   1.132 -fi
   1.133 -if [ ! -f /usr/bin/cabextract ]; then
   1.134 -    cd $CUR_DIR
   1.135 -    echo "Could not find cabextract. Exiting."
   1.136 -    exit
   1.137 -fi
   1.138 -
   1.139 -cd $TEMP_DIR
   1.140 -rm -rf cab-contents && mkdir cab-contents
   1.141 -mkdir -p $PACKAGE-$VERSION/fs/usr/share/fonts/truetype/$PACKAGE/
   1.142 -
   1.143 -font_files="andale32.exe arial32.exe arialb32.exe comic32.exe courie32.exe georgi32.exe impact32.exe times32.exe trebuc32.exe webdin32.exe verdan32.exe"
   1.144 -
   1.145 -for i in $font_files
   1.146 -do
   1.147 -	if [ -f downloads/$i ]
   1.148 -	then
   1.149 -		cabextract --lowercase --directory=cab-contents downloads/$i
   1.150 -	fi
   1.151 -	mv cab-contents/*.ttf $PACKAGE-$VERSION/fs/usr/share/fonts/truetype/$PACKAGE/
   1.152 -	rm -f cab-contents/*
   1.153 -done
   1.154 -
   1.155 -cabextract --lowercase --directory=cab-contents downloads/wd97vwr32.exe
   1.156 -cabextract --lowercase --directory=cab-contents cab-contents/viewer1.cab
   1.157 -mv cab-contents/*.ttf $PACKAGE-$VERSION/fs/usr/share/fonts/truetype/$PACKAGE/
   1.158 -rm -f cab-contents/*
   1.159 -
   1.160  cd $TEMP_DIR
   1.161  
   1.162 -cat > $PACKAGE-$VERSION/receipt << EOT
   1.163 +cat > $PACKAGE-$VERSION/receipt <<EOT
   1.164 +# SliTaz package receipt.
   1.165 +
   1.166  PACKAGE="$PACKAGE"
   1.167  VERSION="$VERSION"
   1.168  CATEGORY="non-free"
   1.169 -SHORT_DESC="TrueType core fonts for the web."
   1.170 -DEPENDS="fontconfig"
   1.171 +SHORT_DESC="Microsoft's TrueType core fonts"
   1.172 +MAINTAINER="rocky@slitaz.org"
   1.173 +LICENSE="non-free"
   1.174  WEB_SITE="http://sourceforge.net/projects/corefonts"
   1.175  TAGS="fonts"
   1.176  
   1.177 +DEPENDS="fontconfig"
   1.178 +
   1.179  # Pre and post install commands for Tazpkg.
   1.180  post_install()
   1.181  {
   1.182 -	local root
   1.183 -	root=\${1:-/}
   1.184 -	echo "Processing post-install commands..."
   1.185 -	chroot \$root/ /usr/bin/fc-cache /usr/share/fonts/truetype/msttcorefonts >/dev/null 2>&1
   1.186 +	chroot "\$1/" /usr/bin/fc-cache /usr/share/fonts/truetype/$PACKAGE
   1.187  }
   1.188  EOT
   1.189  
   1.190  # Pack
   1.191 -tazpkg pack $PACKAGE-$VERSION
   1.192 +tazpkg pack $PACKAGE-$VERSION gzip
   1.193  
   1.194  # Clean to save RAM memory
   1.195  rm -rf $PACKAGE-$VERSION