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

# no flags no compile

P=jwm-themes
SRC=unpack
USER=`cat /etc/sysconfig/tcuser`
LIST="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 \
https://sourceforge.net/projects/jwmkit/files/themes/all_themes.zip \
https://codeberg.org/JWMKit/JWM_Kit/raw/branch/master/doc/LICENSE "  $USER
chown root:root LICENSE
mv LICENSE JWMKit-LICENSE
mkdir $SRC
mv all_themes.zip $SRC
cd $SRC
unzip all_themes.zip

LISTDIR="Adwaita-Dark Aros beach Bluesky-1 DarkMint Numix "	
for Z in $LISTDIR
do
	mkdir -p $P/usr/local/share/$P/$Z
done
 
# I lack the skill to rename in one command
mv $SRC/Adwaita*      $P/usr/local/share/$P/Adwaita-Dark/.jwmrc-theme
mv $SRC/Aros*         $P/usr/local/share/$P/Aros/.jwmrc-theme
mv $SRC/beach*        $P/usr/local/share/$P/beach/.jwmrc-theme
mv $SRC/Bluesky-1* $P/usr/local/share/$P/Bluesky-1/.jwmrc-theme
mv $SRC/DarkMint*     $P/usr/local/share/$P/DarkMint/.jwmrc-theme
mv $SRC/Numix.theme     $P/usr/local/share/$P/Numix/.jwmrc-theme

mkdir -p $P/usr/local/share/doc/$P
mv JWMKit-LICENSE $P/usr/local/share/doc/$P

# TCZ them
###########
LIST2="$P  "
for Z in $LIST2
do
	mksquashfs $Z $Z.tcz
	md5sum $Z.tcz > $Z.tcz.md5.txt
	cd $Z
	find . -not -type d | cut -c 2- | sort > /tmp/$Z.tcz.list
	cd /tmp
done

ls -hal

echo "Title:          jwm-themes.tcz
Description:    6 themes for Joe's Window Manager 
Version:        1
Author:         for JWMKit - Calvin Kent McNabb
                non-JWMKit - unknown
Original-site:  https://codeberg.org/JWMKit/JWM_Kit/wiki/themes
Copying-policy: for JWMKit GPL v2
                non-JWMKit unknown
Size:           4.0K
Extension_by:   aus9 @linuxquestions.org   
Tags:           window manager theme themes
Comments:       ~/.jwmrc has config line 
                <Include>./.jwmrc-theme</Include>
                Only if you or maintainer have changed that line, 
                do you need to change below's instruction.
                
                Copy from 
/tmp/tcloop/jwm-themes/usr/local/share/jwm-themes/<dir-name>/.jwmrc-theme
                to root of your $HOME dir so it becomes 
                eg /home/tc/.jwmrc-theme
                Agree to over write existing theme.
                Read it in a text editor, browser etc
                Load the named font eg DejaVu Sans-10 comes from 
                TCE= dejavu-fonts-ttf.tcz
                Some font TCEs offer alternative fonts
                eg liberation and nimbus*                

                Beauty is in the mind of the beholder.
                I believe dark theme is Adwaita-Dark,
                light is Aros, blue is Bluesky-1, green is beach and 
                2 contrasts are DarkMint (yes its dark) and Numix 

                Naturally you can edit to change fonts, colours etc       
                     
Change-log:     2024/11/05 Any arch 
Current:        2024/11/05" > $P.tcz.info

# NO DEP as I do not know which jwm* TCE member is using
submitqc --libs
rm -rf *.zsync

