From 93996e58f85e0f5ae26b5f8bd9ff63991a3e8716 Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Thu, 20 Jan 2022 18:19:23 -0600 Subject: [PATCH] Move files to category subdirs, and add shuffle script --- PKGBUILD | 11 ++++++++--- tl-wallpaper-shuf.bash | 11 +++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100755 tl-wallpaper-shuf.bash diff --git a/PKGBUILD b/PKGBUILD index e43d405..98a36cf 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: David Thurstenson pkgname=tl-wallpaper -pkgver=r15.b6ed6fc +pkgver=r16.7ec3d15 pkgrel=1 pkgdesc="Thurstylark's collection of wallpapers" arch=(any) @@ -18,6 +18,11 @@ pkgver() { package() { cd ${srcdir}/${pkgname} install -d "${pkgdir}/usr/share/backgrounds/thurstylark/" - install -m644 *.jpg "${pkgdir}/usr/share/backgrounds/thurstylark/" - install -m644 *.png "${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 } diff --git a/tl-wallpaper-shuf.bash b/tl-wallpaper-shuf.bash new file mode 100755 index 0000000..ba86c2e --- /dev/null +++ b/tl-wallpaper-shuf.bash @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Start in the script's pwd +# (ideally something like /usr/share/wallpapers/thurstylark/) +wallp_dir=$(dirname "$0") + +# Get one subdir from $wallp_dir +wallp_subdir=$(find "$wallp_dir" -type d | shuf -n 1) + +# Get one file from $wallp_subdir +find $walp_subdir -type f \( -iname \*.jpg -o -iname \*.png \) | shuf -n 1