summaryrefslogtreecommitdiff
path: root/packages/qpf-fonts/files
diff options
context:
space:
mode:
authorMichael Lauer <mickey@vanille-media.de>2005-04-03 13:48:55 +0000
committerMichael Lauer <mickey@vanille-media.de>2005-04-03 13:48:55 +0000
commit8b166bdd9e0cf0328e80393fbd8785191c36cd11 (patch)
tree97b22bc413e5279130cc1bcfa7fb6ffb544583a7 /packages/qpf-fonts/files
parent07f1adeae8247f49c61330ba008635b820b758d6 (diff)
Merge bk://oe-devel@oe-devel.bkbits.net/openembedded
into gandalf.tm.informatik.uni-frankfurt.de:/local/pkg/oe/packages 2005/04/03 15:48:27+02:00 uni-frankfurt.de!mickeyl improve update-qtfontdir to only run if necessary, i.e. when its timestamp is older than anything in QTDIR/fonts/ BKrev: 424ff447OlzQOKD9EGJ4PtRiMqzZGg
Diffstat (limited to 'packages/qpf-fonts/files')
-rw-r--r--packages/qpf-fonts/files/update-qtfontdir70
1 files changed, 70 insertions, 0 deletions
diff --git a/packages/qpf-fonts/files/update-qtfontdir b/packages/qpf-fonts/files/update-qtfontdir
index e69de29bb2..788c0b307d 100644
--- a/packages/qpf-fonts/files/update-qtfontdir
+++ b/packages/qpf-fonts/files/update-qtfontdir
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+usage()
+{
+ echo "usage: $0 [font directory, defaults to QTDIR/lib/fonts]"
+ exit 1
+}
+
+setVar()
+{
+ eval "$1='$2'"
+}
+
+getVar()
+{
+ eval "echo \$$1"
+}
+
+handleQPF()
+{
+ base=`basename $1`
+ family=`echo $base|cut -d_ -f1`
+ pt=`echo $base|cut -d_ -f2`
+ weight=`echo $base|cut -d_ -f3|sed -e 's,i$,,'`
+ if (echo $base|cut -d_ -f3|grep -q 'i$'); then
+ italic="y"
+ else
+ italic="n"
+ fi
+ echo "$family $base.qpf QPF $italic $weight $pt u"
+}
+
+if [ -z "$1" ]; then
+ if [ -n "$QTDIR" ]; then
+ fontdir=$QTDIR/lib/fonts
+ else
+ fontdir=/opt/QtPalmtop/lib/fonts
+ fi
+else
+ fontdir=$1
+fi
+
+if ! [ -d $fontdir ]; then
+ echo Error: $fontdir not a directory
+ exit 1
+fi
+
+if [ -e $fontdir/fontdir ]; then
+ if find $fontdir -newer $fontdir/fontdir | grep "\(qpf\|ttf\)"; then
+ echo "fontdir needs updating..."
+ else
+ echo "fontdir already up to date - exiting"
+ exit 0
+ fi
+ cat $fontdir/fontdir | grep -v '\.qpf' > $fontdir/fontdir.new
+else
+ echo "fontdir not existing. creating..."
+fi
+
+(
+ for file in `ls $fontdir/*.qpf|sed -e's,\.qpf$,,; s,_t[^_]*$,,;'|sort -u`; do
+ handleQPF $file
+ done
+) >> $fontdir/fontdir.new
+
+mv $fontdir/fontdir.new $fontdir/fontdir
+
+exit 0
+
+# vim:ai:et:sts=4:sw=4:tw=0: