From d2f4323d688dc3823f8e9726a0ace3d170785204 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 13 Nov 2012 13:30:31 +0100 Subject: [PATCH] fix the corner case of an empty or non existing install-rpms/ --- plc.d/packages | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plc.d/packages b/plc.d/packages index d97fa54..5c59f30 100755 --- a/plc.d/packages +++ b/plc.d/packages @@ -119,8 +119,10 @@ case "$1" in if [[ -n "$@" ]] ; then repositories="$@" else - # use all subdirs in install-rpms by default, except the slice repos - repositories=$(ls -d /var/www/html/install-rpms/* | grep -v /slice-) + # consider all subdirs in install-rpms by default, except the slice repos + # use find instead of ls - for the corner case where the dir. is empty + # (thanks Thomas Dreibholz for the heads up) + repositories=$(find /var/www/html/install-rpms -maxdepth 1 -mindepth 1 -type d \! -name 'slice-*' >& /dev/null) fi # filter out PRESERVE'd repos -- 2.43.0