wok annotate get-msttcorefonts/stuff/get-msttcorefonts @ rev 13673
get-skype: new tarball,depends
author | Richard Dunbar <mojo@slitaz.org> |
---|---|
date | Sun Nov 25 03:41:58 2012 +0000 (2012-11-25) |
parents | |
children | 6fab3264ba87 |
rev | line source |
---|---|
rocky@5325 | 1 #!/bin/sh |
rocky@5325 | 2 |
rocky@5325 | 3 PACKAGE="msttcorefonts" |
rocky@5325 | 4 VERSION="2.0" |
rocky@5325 | 5 CUR_DIR=$(pwd) |
rocky@5325 | 6 TEMP_DIR=/tmp/$PACKAGE-$VERSION |
rocky@5325 | 7 ROOT= |
rocky@5325 | 8 |
rocky@5325 | 9 # Check if we are root |
rocky@5325 | 10 if test $(id -u) != 0 ; then |
rocky@5325 | 11 echo -e "\nYou must be root to run `basename $0`." |
rocky@5325 | 12 echo -e "Please type 'su' and root password to become super-user.\n" |
rocky@5325 | 13 exit 1 |
rocky@5325 | 14 fi |
rocky@5325 | 15 |
rocky@5325 | 16 # Avoid reinstall |
rocky@5325 | 17 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then |
rocky@5325 | 18 echo -e "\n$PACKAGE package is already installed.\n" |
rocky@5325 | 19 exit 1 |
rocky@5325 | 20 fi |
rocky@5325 | 21 |
rocky@5325 | 22 # Create a TEMP_DIR |
rocky@5325 | 23 mkdir -p $TEMP_DIR/downloads |
rocky@5325 | 24 cd $TEMP_DIR/downloads |
rocky@5325 | 25 |
rocky@5325 | 26 # this is the sourceforge mirrorlist as of 2006-04-30. If someone spots changes |
rocky@5325 | 27 # over at sourcforge, feel free to email me and I'll update the list |
rocky@5325 | 28 mirrors="easynews+heanet+superb-west+internap+switch+ufpr+surfnet+umn+kent+mesh+superb-east+jaist" |
rocky@5325 | 29 mirror_count=12 |
rocky@5325 | 30 |
rocky@5325 | 31 andale32_md5="cbdc2fdd7d2ed0832795e86a8b9ee19a andale32.exe" |
rocky@5325 | 32 arial32_md5="9637df0e91703179f0723ec095a36cb5 arial32.exe" |
rocky@5325 | 33 arialb32_md5="c9089ae0c3b3d0d8c4b0a95979bb9ff0 arialb32.exe" |
rocky@5325 | 34 comic32_md5="2b30de40bb5e803a0452c7715fc835d1 comic32.exe" |
rocky@5325 | 35 courie32_md5="4e412c772294403ab62fb2d247d85c60 courie32.exe" |
rocky@5325 | 36 georgi32_md5="4d90016026e2da447593b41a8d8fa8bd georgi32.exe" |
rocky@5325 | 37 impact32_md5="7907c7dd6684e9bade91cff82683d9d7 impact32.exe" |
rocky@5325 | 38 times32_md5="ed39c8ef91b9fb80f76f702568291bd5 times32.exe" |
rocky@5325 | 39 trebuc32_md5="0d7ea16cac6261f8513a061fbfcdb2b5 trebuc32.exe" |
rocky@5325 | 40 webdin32_md5="230a1d13a365b22815f502eb24d9149b webdin32.exe" |
rocky@5325 | 41 verdan32_md5="12d2a75f8156e10607be1eaa8e8ef120 verdan32.exe" |
rocky@5325 | 42 wd97vwr32_md5="efa72d3ed0120a07326ce02f051e9b42 wd97vwr32.exe" |
rocky@5325 | 43 |
rocky@5325 | 44 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" |
rocky@5325 | 45 |
rocky@5325 | 46 failures=0 |
rocky@5325 | 47 |
rocky@5325 | 48 set_mirror() { |
rocky@5325 | 49 local r m |
rocky@5325 | 50 r=`expr $RANDOM % $mirror_count + 1` |
rocky@5325 | 51 m=`echo $mirrors |cut -d+ -f$r` |
rocky@5325 | 52 mirror="http://${m}.dl.sourceforge.net/sourceforge/corefonts/" |
rocky@5325 | 53 } |
rocky@5325 | 54 |
rocky@5325 | 55 check_file() { |
rocky@5325 | 56 matches=no |
rocky@5325 | 57 if [ ! -r $1 ] |
rocky@5325 | 58 then |
rocky@5325 | 59 echo "$1 does not exist" |
rocky@5325 | 60 return |
rocky@5325 | 61 fi |
rocky@5325 | 62 local variable_name=`basename $1 .exe`_md5 |
rocky@5325 | 63 local stored_checksum |
rocky@5325 | 64 eval stored_checksum=\$$variable_name |
rocky@5325 | 65 local computed_checksum=`md5sum $1` |
rocky@5325 | 66 if [ "$stored_checksum" = "$computed_checksum" ] |
rocky@5325 | 67 then |
rocky@5325 | 68 matches=yes |
rocky@5325 | 69 else |
rocky@5325 | 70 rm $1 |
rocky@5325 | 71 matches=no |
rocky@5325 | 72 fi |
rocky@5325 | 73 } |
rocky@5325 | 74 |
rocky@5325 | 75 download() { |
rocky@5325 | 76 curl --retry 5 -H Pragma: -R -S -L -o "$2" $1$2 |
rocky@5325 | 77 } |
rocky@5325 | 78 |
rocky@5325 | 79 # Download the file |
rocky@5325 | 80 set_mirror |
rocky@5325 | 81 |
rocky@5325 | 82 if [ ! -d /var/lib/tazpkg/installed/curl ]; then |
rocky@5325 | 83 tazpkg get-install curl |
rocky@5325 | 84 fi |
rocky@5325 | 85 if [ ! -f /usr/bin/curl ]; then |
rocky@5325 | 86 cd $CUR_DIR |
rocky@5325 | 87 echo "Could not find curl. Exiting." |
rocky@5325 | 88 exit |
rocky@5325 | 89 fi |
rocky@5325 | 90 |
rocky@5325 | 91 for f in $download_files |
rocky@5325 | 92 do |
rocky@5325 | 93 check_file $f |
rocky@5325 | 94 while [ $matches != yes ] |
rocky@5325 | 95 do |
rocky@5325 | 96 download $mirror $f |
rocky@5325 | 97 check_file $f |
rocky@5325 | 98 if [ $matches != yes ] |
rocky@5325 | 99 then |
rocky@5325 | 100 echo "failed to download $mirror$f" |
rocky@5325 | 101 failures=`expr $failures + 1` |
rocky@5325 | 102 if [ $failures -gt 5 ] |
rocky@5325 | 103 then |
rocky@5325 | 104 echo "failed to download too many times." |
rocky@5325 | 105 exit |
rocky@5325 | 106 fi |
rocky@5325 | 107 set_mirror |
rocky@5325 | 108 fi |
rocky@5325 | 109 done |
rocky@5325 | 110 done |
rocky@5325 | 111 |
rocky@5325 | 112 # Extract fonts |
rocky@5325 | 113 if [ ! -d /var/lib/tazpkg/installed/cabextract ]; then |
rocky@5325 | 114 tazpkg get-install cabextract |
rocky@5325 | 115 fi |
rocky@5325 | 116 if [ ! -f /usr/bin/cabextract ]; then |
rocky@5325 | 117 cd $CUR_DIR |
rocky@5325 | 118 echo "Could not find cabextract. Exiting." |
rocky@5325 | 119 exit |
rocky@5325 | 120 fi |
rocky@5325 | 121 |
rocky@5325 | 122 cd $TEMP_DIR |
rocky@5325 | 123 rm -rf cab-contents && mkdir cab-contents |
rocky@5325 | 124 mkdir -p $PACKAGE-$VERSION/fs/usr/share/fonts/truetype/$PACKAGE/ |
rocky@5325 | 125 |
rocky@5325 | 126 font_files="andale32.exe arial32.exe arialb32.exe comic32.exe courie32.exe georgi32.exe impact32.exe times32.exe trebuc32.exe webdin32.exe verdan32.exe" |
rocky@5325 | 127 |
rocky@5325 | 128 for i in $font_files |
rocky@5325 | 129 do |
rocky@5325 | 130 if [ -f downloads/$i ] |
rocky@5325 | 131 then |
rocky@5325 | 132 cabextract --lowercase --directory=cab-contents downloads/$i |
rocky@5325 | 133 fi |
rocky@5325 | 134 mv cab-contents/*.ttf $PACKAGE-$VERSION/fs/usr/share/fonts/truetype/$PACKAGE/ |
rocky@5325 | 135 rm -f cab-contents/* |
rocky@5325 | 136 done |
rocky@5325 | 137 |
rocky@5325 | 138 cabextract --lowercase --directory=cab-contents downloads/wd97vwr32.exe |
rocky@5325 | 139 cabextract --lowercase --directory=cab-contents cab-contents/viewer1.cab |
rocky@5325 | 140 mv cab-contents/*.ttf $PACKAGE-$VERSION/fs/usr/share/fonts/truetype/$PACKAGE/ |
rocky@5325 | 141 rm -f cab-contents/* |
rocky@5325 | 142 |
rocky@5325 | 143 cd $TEMP_DIR |
rocky@5325 | 144 |
rocky@5325 | 145 cat > $PACKAGE-$VERSION/receipt << EOT |
rocky@5325 | 146 PACKAGE="$PACKAGE" |
rocky@5325 | 147 VERSION="$VERSION" |
rocky@5325 | 148 CATEGORY="non-free" |
rocky@5325 | 149 SHORT_DESC="TrueType core fonts for the web." |
rocky@5325 | 150 DEPENDS="fontconfig" |
rocky@5325 | 151 WEB_SITE="http://sourceforge.net/projects/corefonts" |
rocky@5325 | 152 TAGS="fonts" |
rocky@5325 | 153 |
rocky@5325 | 154 # Pre and post install commands for Tazpkg. |
rocky@5325 | 155 post_install() |
rocky@5325 | 156 { |
rocky@5325 | 157 local root |
rocky@5325 | 158 root=\${1:-/} |
rocky@5325 | 159 echo "Processing post-install commands..." |
rocky@5325 | 160 chroot \$root/ /usr/bin/fc-cache /usr/share/fonts/truetype/msttcorefonts >/dev/null 2>&1 |
rocky@5325 | 161 } |
rocky@5325 | 162 EOT |
rocky@5325 | 163 |
rocky@5325 | 164 # Pack |
rocky@5325 | 165 tazpkg pack $PACKAGE-$VERSION |
rocky@5325 | 166 |
rocky@5325 | 167 # Clean to save RAM memory |
rocky@5325 | 168 rm -rf $PACKAGE-$VERSION |
rocky@5325 | 169 |
rocky@5325 | 170 # Install pseudo package |
rocky@5325 | 171 yes y | tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT |
rocky@5325 | 172 |
rocky@5325 | 173 # Clean |
rocky@5325 | 174 cd $CUR_DIR |
rocky@5325 | 175 rm -rf $TEMP_DIR |