From: Thierry Parmentelat Date: Tue, 13 Nov 2012 12:30:31 +0000 (+0100) Subject: fix the corner case of an empty or non existing install-rpms/ X-Git-Tag: nodeimage-2.1-3~1 X-Git-Url: http://git.onelab.eu/?p=bootstrapfs.git;a=commitdiff_plain;h=d2f4323d688dc3823f8e9726a0ace3d170785204 fix the corner case of an empty or non existing install-rpms/ --- 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