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

P=nimbus-roman-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-roman-no9-l.zip " $USER 
unzip nim*zip

# main
#####
mkdir -p $P/usr/local/share/fonts/nimbus-roman
mv *otf $P/usr/local/share/fonts/nimbus-roman
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-roman-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 serif  
Comments:       Full name=Nimbus Roman No 9 L is a serif typeface created by 
                URW Studio in 1987, and eventually released under the GPL. 
                It features Normal, Bold, Italic, and Bold Italic weights, 
                and is one of several freely licensed fonts offered by URW++.

                Although the characters are not exactly the same, 
                Nimbus Roman No 9 L has metrics almost identical to Times 
                and Times New Roman. It is one of the Ghostscript fonts, 
                a free alternative to 35 basic PostScript fonts (which include Times).

                In the past, it was used as default font in OpenOffice.org Writer in some 
                Linux distributions but "they" may have changed to Liberation Serif.
                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.     

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