From 2cfffee19b9848a9e39e6149cbd97e23e7adddbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 28 Aug 2016 20:39:11 +0200 Subject: [PATCH] handle subdirs and symlinks in $wallpaperdir Thanks for the base patch, kindly provided by some Anonymous coward on the bugtracker ;-) BUG: 1065 --- util/fbsetbg | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/fbsetbg b/util/fbsetbg index 0cf9cfb4..fb6f3afe 100644 --- a/util/fbsetbg +++ b/util/fbsetbg @@ -511,7 +511,9 @@ if [ "$option" = random ]; then exit 1 fi if [ -d "$wallpaperdir" ]; then - number_of_wallpapers=`ls "$wallpaperdir"|wc -l` + cd "$wallpaperdir" + available_wallpapers=`find -L -type f ! -regex '.*/\..*'` + number_of_wallpapers=`echo "$available_wallpapers" | wc -l` if find_it random_number; then randomnumber=`random_number` # some shells don't support $RANDOM @@ -531,7 +533,7 @@ if [ "$option" = random ]; then fi remember=false #set -x - wallpaper="$wallpaperdir/`ls \"$wallpaperdir\"|sed -n ${wallpapernumber}p`" + wallpaper="`echo "$available_wallpapers" | sed -n ${wallpapernumber}p`" option=$option2 # have to choose something... else message "Invalid random wallpaper directory specified: '$wallpaperdir'."