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

# no flags its unpack and repack

P1=Arc-Dark
P=icewm-Arc-Dark-theme
V=1.2
SRC=$P1-$V
USER=`cat /etc/sysconfig/tcuser`
LIST="squashfs-tools wget zstd"
for Z in $LIST 
    do 
    su -c "tce-load -i $Z" $USER
done

# la files can be ignored

cd /tmp
su -c "/usr/local/bin/wget -nc \
https://github.com/Brottweiler/$P1/releases/download/v$V/$SRC.tar.zst " $USER
zstd -d $SRC*zst && tar xvf $SRC.tar
# unpacks as Arc Dark no hypens/understems
rm -rf Arc-Dark*
mv Arc* $P1

# main start afresh
#####
mkdir -p $P/usr/local/share/icewm/themes
mv $P1 $P/usr/local/share/icewm/themes
# no licence found

# 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

ls -hal

echo 'Title:          icewm-Arc-Dark-theme.tcz
Description:    dark theme for icewm
Version:        1.2
Author:         Aethus
Original-site:  https://github.com/Brottweiler/Arc-Dark
Copying-policy: open source unknown
Size:           8K		
Extension_by:   aus9 
Tags:           icewm theme 
Comments:       dark menu with dark decorations 
                If you have lxterminal and no aterm,
                xterm will launch lxterminal

                Use menu -> settings -> Themes to choose theme

Change-log:     2023/08/21 v 1.2 any arch
Current:        2023/08/21 '  > $P.tcz.info

# no dep set
