fix the corner case of an empty or non existing install-rpms/
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Tue, 13 Nov 2012 12:30:31 +0000 (13:30 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Tue, 13 Nov 2012 12:30:31 +0000 (13:30 +0100)
plc.d/packages

index d97fa54..5c59f30 100755 (executable)
@@ -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