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

export CFLAGS="-mtune=generic -Os -pipe"
export CXX="-mtune=generic -Os -pipe -fno-exceptions -fno-rtti" 

P2=skeuos-gtk2-themes
DIR2=/tmp/$P2/usr/local/share/themes

P3=skeuos-gtk3-themes
DIR3=/tmp/$P3/usr/local/share/themes

P4=skeuos-gtk4-themes
DIR4=/tmp/$P4/usr/local/share/themes

PG=skeuos-gnome42-themes
DIRG=/tmp/$PG/usr/local/share/themes

V=20220629
SRC=skeuos-gtk-$V

USER=`cat /etc/sysconfig/tcuser`
LIST="compiletc submitqc  "
for Z in $LIST
    do 
    su -c "tce-load -i $Z" $USER
done

cd /tmp
/usr/local/bin/wget -nc --no-check-certificate \
https://github.com/daniruiz/skeuos-gtk/archive/refs/tags/20220629.tar.gz 
tar xvf 20220629.tar.gz
cd $SRC
chmod 755 Makefile
sed 's|usr|usr/local|' -i Makefile
make install DESTDIR=/tmp/$P2 # no strip  put all into gtk2 and fix below
cd /tmp

mkdir -p $P3/usr/local/share/themes  $P4/usr/local/share/themes $PG/usr/local/share/themes

# submitqc finds file perm issues fix....do it before splits
find $P2 -type d       | xargs chmod 755
find $P2 -name *.png   | xargs chmod 644 
find $P2 -name *.css   | xargs chmod 644
find $P2 -name *.svg   | xargs chmod 644
find $P2 -name *rc     | xargs chmod 644
find $P2 -name *.theme | xargs chmod 644

# delete unloved desktops more gnomes done later
rm -rf $P2/usr/local/share/themes/*XFWM*
find $P2 -type d -name cinnamon   | xargs rm -rf 
find $P2 -type d -name metacity-1 | xargs rm -rf 

# move gnome stuff
####################
cd $P2/usr/local/share/themes
LISTG="Skeuos-Black-Light-FullPanel-GNOME_42 Skeuos-Black-Light-GNOME_42 Skeuos-Blue-Dark-FullPanel-GNOME_42 \
Skeuos-Blue-Dark-GNOME_42 Skeuos-Blue-Light-FullPanel-GNOME_42 Skeuos-Blue-Light-GNOME_42 Skeuos-Brown-Dark-FullPanel-GNOME_42 \
Skeuos-Brown-Dark-GNOME_42 Skeuos-Brown-Light-FullPanel-GNOME_42 Skeuos-Brown-Light-GNOME_42 \
Skeuos-Cyan-Dark-FullPanel-GNOME_42 Skeuos-Cyan-Dark-GNOME_42 Skeuos-Cyan-Light-FullPanel-GNOME_42 Skeuos-Cyan-Light-GNOME_42 \
Skeuos-Green-Dark-FullPanel-GNOME_42 Skeuos-Green-Dark-GNOME_42 Skeuos-Green-Light-FullPanel-GNOME_42 Skeuos-Green-Light-GNOME_42 \
Skeuos-Grey-Dark-FullPanel-GNOME_42 Skeuos-Grey-Dark-GNOME_42 Skeuos-Grey-Light-FullPanel-GNOME_42 Skeuos-Grey-Light-GNOME_42 \
Skeuos-Magenta-Dark-FullPanel-GNOME_42 Skeuos-Magenta-Dark-GNOME_42 Skeuos-Magenta-Light-FullPanel-GNOME_42 \
Skeuos-Magenta-Light-GNOME_42 Skeuos-Orange-Dark-FullPanel-GNOME_42 Skeuos-Orange-Dark-GNOME_42 \
Skeuos-Orange-Light-FullPanel-GNOME_42 Skeuos-Orange-Light-GNOME_42 Skeuos-Red-Dark-FullPanel-GNOME_42 \
Skeuos-Red-Dark-GNOME_42 Skeuos-Red-Light-FullPanel-GNOME_42 Skeuos-Red-Light-GNOME_42 Skeuos-Teal-Dark-FullPanel-GNOME_42 \
Skeuos-Teal-Dark-GNOME_42 Skeuos-Teal-Light-FullPanel-GNOME_42 Skeuos-Teal-Light-GNOME_42 Skeuos-Violet-Dark-FullPanel-GNOME_42 \
Skeuos-Violet-Dark-GNOME_42 Skeuos-Violet-Light-FullPanel-GNOME_42 Skeuos-Violet-Light-GNOME_42 \
Skeuos-White-Dark-FullPanel-GNOME_42 Skeuos-White-Dark-GNOME_42 Skeuos-Yellow-Dark-FullPanel-GNOME_42 \
Skeuos-Yellow-Dark-GNOME_42 Skeuos-Yellow-Light-FullPanel-GNOME_42 Skeuos-Yellow-Light-GNOME_42 "
for Z in $LISTG
do
	mv $Z $DIRG/
done

# the balance of the gnomes are for 36,38,40,41 we delete
rm -rf *GNOME*  # leftovers are  gtk2/3/4 come to tmp for easier dir creations
cd /tmp
LISTX="Skeuos-Black-Light Skeuos-Blue-Dark Skeuos-Blue-Light Skeuos-Brown-Dark Skeuos-Brown-Light Skeuos-Cyan-Dark \
Skeuos-Cyan-Light Skeuos-Green-Dark Skeuos-Green-Light Skeuos-Grey-Dark Skeuos-Grey-Light Skeuos-Magenta-Dark \
Skeuos-Magenta-Light Skeuos-Orange-Dark Skeuos-Orange-Light Skeuos-Red-Dark Skeuos-Red-Light Skeuos-Teal-Dark \
Skeuos-Teal-Light Skeuos-Violet-Dark Skeuos-Violet-Light Skeuos-White-Dark Skeuos-Yellow-Dark Skeuos-Yellow-Light "
for Z in $LISTX
do
	mkdir -p $DIR3/$Z $DIR4/$Z
        mv $DIR2/$Z/gtk-3.0 $DIR3/$Z
        mv $DIR2/$Z/gtk-4.0 $DIR4/$Z
        cp $DIR2/$Z/index.theme $DIR3/$Z/
        cp $DIR2/$Z/index.theme $DIR4/$Z/
done


mkdir -p $P2/usr/local/share/doc/$P2 $P3/usr/local/share/doc/$P3 $P4/usr/local/share/doc/$P4 $PG/usr/local/share/doc/$PG
echo 'GPL v 3' > $P2/usr/local/share/doc/$P2/COPYING
echo 'GPL v 3' > $P3/usr/local/share/doc/$P3/COPYING
echo 'GPL v 3' > $P4/usr/local/share/doc/$P4/COPYING
echo 'GPL v 3' > $PG/usr/local/share/doc/$PG/COPYING

# create TCZ
###########
LIST="$P2 $P3 $P4 $PG  "
for Z in $LIST
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:          skeuos-gtk2-themes.tcz
Description:    skeumorphic gtk2 themes
Version:        20220629
Author:         Daniel Ruiz de Alegría
Original-site:  https://github.com/daniruiz/skeuos-gtk
Copying-policy: GPL v3
Size:           268K         
Extension_by:   aus9 @linuxquestions.org  
Tags:           gtk2  theme
Comments:       Features: bevels (rounded corners)
                - drop-shadows, and gradients
                Many colour-{light|dark} themes
                
                Recommend you use lxappearance to set theme
                Otherwise edit as needed,
                $HOME/.gtkrc-2.0 (eg)
                gtk-theme-name=Skeuos-Yellow-Dark
                           
Change-log:     2025/11/30 any arch 
Current:        2025/11/30   ' > $P2.tcz.info
echo 'librsvg.tcz ' > $P2.tcz.dep

echo 'Title:          skeuos-gtk3-themes.tcz
Description:    skeumorphic gtk3 themes as below
Version:        20220629
Author:         Daniel Ruiz de Alegría
Original-site:  https://github.com/daniruiz/skeuos-gtk
Copying-policy: GPL v3
Size:           1.9M          
Extension_by:   aus9 @linuxquestions.org  
Tags:           gtk3 theme
Comments:       Features: bevels (rounded corners)
                - drop-shadows, and gradients
                Many colour-{light|dark} themes
                
                Recommend you use lxappearance to set theme
                Otherwise edit as needed, (eg)
                $HOME/.config/gtk-3.0/settings.ini
                gtk-theme-name=Skeuos-Yellow-Dark
                           
Change-log:     2025/11/30 any arch 
Current:        2025/11/30   ' > $P3.tcz.info
echo 'librsvg.tcz ' > $P3.tcz.dep

echo 'Title:          skeuos-gtk4-themes.tcz
Description:    skeumorphic gtk4 themes as below
Version:        20220629
Author:         Daniel Ruiz de Alegría
Original-site:  https://github.com/daniruiz/skeuos-gtk
Copying-policy: GPL v3
Size:           1.1M          
Extension_by:   aus9 @linuxquestions.org  
Tags:           gtk4 theme
Comments:       Features: bevels (rounded corners)
                - drop-shadows, and gradients
                Many colour-{light|dark} themes
                
                Recommend you use lxappearance to set theme
                untested gtk4
                           
Change-log:     2025/11/30 any arch 
Current:        2025/11/30   ' > $P4.tcz.info
echo 'librsvg.tcz ' > $P4.tcz.dep

echo 'Title:          skeuos-gnome42-themes.tcz
Description:    skeumorphic themes for gnome 42
Version:        20220629
Author:         Daniel Ruiz de Alegría
Original-site:  https://github.com/daniruiz/skeuos-gtk
Copying-policy: GPL v3
Size:           1.2M          
Extension_by:   aus9 @linuxquestions.org  
Tags:           gnome theme
Comments:       Features: bevels (rounded corners)
                - drop-shadows, and gradients
                Many colour-{light|dark} themes
                
                Recommend you use lxappearance to set theme
                untested by me
                          
Change-log:     2025/11/30 any arch 
Current:        2025/11/30   ' > $PG.tcz.info
echo 'librsvg.tcz ' > $P4.tcz.dep

submitqc --libs 
rm -rf *.zsync


