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

P=nimbus-sans-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/n/i/nimbus-sans-l.zip " $USER 
unzip nim*zip

# main
#####
mkdir -p $P/usr/local/share/fonts/nimbus-sans
mv *otf $P/usr/local/share/fonts/nimbus-sans
mkdir -p $P/usr/local/share/doc/$P
mv GNU*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:          nimbus-sans-fonts.tcz  
Description:    see below
Version:        zip 20180506
Author:         URW Studio  
Original-site:  http://www.1001fonts.com
Copying-policy: GPL v2
Size:		
Extension_by:   aus9 at gmx dot com
Tags:           fonts sans 
Comments:       Full name=Nimbus Sans L, which includes regular and bold weight 
                fonts in all widths and styles, were released under the GPL, 
                and is one of several freely licensed fonts offered by URW++.

                Although the characters are not exactly the same, Nimbus Sans L 
                has metrics almost identical to Helvetica and Arial. Nimbus Sans L 
                is one of the Ghostscript fonts, a set of free alternatives to the 
                35 basic PostScript fonts (which include Helvetica).

                In the past, it was used as default font in OpenOffice.org Calc and 
                Impress in some Linux distributions but "they" may have changed to 
                Liberation Sans. OpenOffice now called libreoffice              
                
                If your App is open when you load this package, please close it 
                and on restart, the fonts should be available. Tested on leafpad
                and libreoffice. In impress to change font, go to format character.       

                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 nimbus-sans-l.zip
rm -rf nimbus-sans-fonts
