# Maintainer: David Thurstenson <thurstylark@gmail.com>
pkgname=tl-wallpaper
pkgver=r18.93996e5
pkgrel=1
pkgdesc="Thurstylark's collection of wallpapers"
arch=(any)
url="https://git.thurstylark.com/thurstylark/${pkgname}.git/"
license=('GPL')
groups=('tlconfig')
depends=('bash')
makedepends=('git')
source=("git+${url}")
md5sums=('SKIP')

pkgver() {
	printf "r%s.%s" "$(git -C ${srcdir}/${pkgname} rev-list --count HEAD)" "$(git -C ${srcdir}/${pkgname} rev-parse --short HEAD)"
}

package() {
	cd ${srcdir}/${pkgname}
	install -d "${pkgdir}/usr/share/backgrounds/thurstylark/"

	install -m755 "tl-wallpaper-shuf.bash" "${pkgdir}/usr/share/backgrounds/thurstylark/"

	for i in $(find . -type f \( -iname \*.jpg -o -iname \*.png \) -printf '%f ' ); do
		install -d "${pkgdir}/usr/share/backgrounds/thurstylark/${i%%-*}"
		install -m644 "$i" "${pkgdir}/usr/share/backgrounds/thurstylark/${i%%-*}/"
	done
}
