#!/bin/sh
# test we are root
if [ "$USER" != "root" ] ; then
   echo "Run as root please, exiting." 
   exit 1                                                      
fi

DL1=https://dl.opendesktop.org/api/files/downloadfile
DL2=id/1523821752/s/e196378f4ab9fa9b23b3047d410bb36d/t/1524206616/u/476506
P=Ant-Dracula-Blue
SRC=$P-src
USER=`cat /etc/sysconfig/tcuser`
LIST="submitqc unzip"
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 \
$DL1/$DL2/$P.zip " $USER
unzip $P*zip
mv $P $SRC
# remove tiny bits
rm -rf $SRC/.git
rm -rf $SRC/LICENSE
rm -rf $SRC/README*
mkdir -p $P/usr/local/share/themes
mv $SRC $P/usr/local/share/themes/$P

# main
#####
mkdir -p $P/usr/local/share/doc/$P
echo 'https://github.com/Michedev/Ant-Dracula-Blue/blob/master/LICENSE' > $P/usr/local/share/doc/$P/COPYING

# 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 'gtk3.tcz' > $P.tcz.dep

echo 'Title:          Ant-Dracula-Blue.tcz  
Description:    gtk3 dark theme for XFCE/Gnome
Version:        GIT 20180420
Author:         Michedev
Original-site:  https://www.gnome-look.org/p/1218368/
Copying-policy: GPL v3
Size:		
Extension_by:   aus9 at gmx dot com
Tags:           xfce xfwm4 theme 
Comments:       Dark theme based on Ant-Dracula theme
                
                XFCE settings -> Appearance -> Style -> theme-name  
                XFCE settings -> Window Manager -> Style -> theme-name

                May work on other WMs

                Compiled for 64 9.x
Change-log:     2018/04/20  First version 
Current:        2018/04/20 ' > $P.tcz.info

submitqc --libs
