#!/bin/sh
# test we are root
if [ "$(id -u)" != "0" ]; then
   echo "run as root now exitting"
   exit 1
fi

P=oxygen-fonts
USER=`cat /etc/sysconfig/tcuser`
LIST="compiletc submitqc  "
for Z in $LIST 
    do 
    su -c "tce-load -i $Z" $USER
done

cd /tmp
su -c "/usr/local/bin/wget -nc --no-check-certificate \
http://dl.cdn.1001fonts.net/niceid/o/x/oxygen.zip " $USER 
unzip oxy*zip

# main
#####
mkdir -p $P/usr/local/share/fonts/oxygen
mv *ttf $P/usr/local/share/fonts/oxygen
mkdir -p $P/usr/local/share/doc/$P
mv OFL.txt $P/usr/local/share/doc/$P/COPYING

# tce.installed none required not sure why
##############

# TCZ them
#######
LIST="$P "
for Z in $LIST
do
	mksquashfs $Z $Z.tcz
	md5sum $Z.tcz > $Z.tcz.md5.txt
	cd $Z
	find usr -not -type d > /tmp/$Z.tcz.list
        sed 's|usr|/usr|g' -i /tmp/$Z.tcz.list
	cd /tmp
done

echo 'Title:          oxygen-fonts.tcz  
Description:    see below
Version:        zip 20180506
Author:         Vernon Adams 
Original-site:  http://www.1001fonts.com
Copying-policy: SIL Open Font v 1.1
Size:		
Extension_by:   aus9 at gmx dot com
Tags:           fonts unicode
Comments:       The Oxygen typeface family is created as part of the 
                KDE Project, a libre desktop for the GNU+Linux 
                operating system. The design is optimised for 
                the FreeType font rendering system and works well 
                in all graphical user interfaces, desktops and devices.

                This is a web font version of Oxygen, designed to be 
                used freely across the internet by web browsers on 
                desktop computers, laptops and mobile devices.

                Oxygen is a Unicode typeface family that supports 
                languages that use the Latin script and its variants              
                
                If your App is open when you load this package, please close it 
                and on restart, the fonts should be available. Tested on leafpad
                
                Compiled for 64 9.x
Change-log:     2018/05/06  First version 
Current:        2018/05/06 ' > $P.tcz.info

submitqc --libs

# tidy up in case check more fonts
rm -rf oxygen.zip
rm -rf oxygen-fonts

