#!/bin/sh
# execute one up
source ./_00build.conf
source ./DISTRO_SPECS
setvar XCWD = $(pwd)
# check what version it is
setvar MK_VER = $(mkwallpaper|head -n1|cut -d'-' -f2)
test -f ${XCWD}/support/mkwall.conf && source mkwall.conf
ls /usr/share/fonts/default/TTF|grep -q 'Orbitron' && setvar FONT = 'Orbitron' || setvar FONT = 'Sans' # fancy font
test -n $CFONT && setvar FONT = "$CFONT"
setvar DIMS_X_Y = ""640 350""
setvar FSIZE = '42'
test -n $CFSIZE && setvar FSIZE = "$CFSIZE"
setvar IMG = "${XCWD}/rootfs-skeleton/usr/share/doc/puppylogo96-trans.png" # embedded image for newer mkwallpaper
test -n $CIMG && setvar IMG = "$CIMG"
setvar WCWD = "${XCWD}/sandbox3/rootfs-complete"
setvar OUT_BG = "${WCWD}/usr/share/backgrounds"
setvar STRING = "$DISTRO_FILE_PREFIX"
test -n $CSTRING && setvar STRING = "$CSTRING"
if test $CUSTOM_WALLPAPERS = "yes"{
	mkwallpaper | grep -wq '\-k' && setvar opt = ''-kyes'' || setvar opt = ''''
	shell {cd sandbox3/rootfs-complete
	source etc/DISTRO_SPECS
	for e in 1 2 3 4 5 6 7 8 {
		case (e) {
			1 {setvar color = ''0.3 0.3 0.3''		} #dark grey
			2 {setvar color = ''0.70 0.30 0.40''	} #raspberry
			3 {setvar color = ''0.00 0.75 0.75''	} #teale
			4 {setvar color = ''0.2 0.7 0.1''		} #green
			5 {setvar color = ''0.55 0.25	0.60''	} #purply violet
			6 {setvar color = ''0.1 0.1 0.8''		} #darkish blue
			7 {setvar color = ''0.73 0.55 0.52''	} #salmon
			8 {setvar color = ''0.6 0.7 0.8''		} #light blue
		}
		if vercmp $MK_VER ge 0.8{
			echo #do new stuff
			mkwallpaper -n ${DISTRO_FILE_PREFIX}-wall${e} -l $STRING \
			-f $FONT -i0 -s $FSIZE -x1280 -y800 -kyes -jbr -z $color -e"${IMG} $DIMS_X_Y" -d${OUT_BG} #-ppng hmm.. maybe smaller
		} else {
			mkwallpaper -n ${DISTRO_FILE_PREFIX}-wall${e} -l $DISTRO_FILE_PREFIX -x1024 -y768 -z $color ${opt} -w woof
		}
	}
	}
}
echo "created custom wallpapers"