]> git.ipfire.org Git - thirdparty/dehydrated.git/commitdiff
Handle case where no files to cleanup exists. 141/head
authorJoachim Bauch <bauch@struktur.de>
Tue, 16 Feb 2016 16:56:43 +0000 (17:56 +0100)
committerJoachim Bauch <bauch@struktur.de>
Thu, 18 Feb 2016 08:36:52 +0000 (09:36 +0100)
This fixes cases where "*.foo" expands to the string "*.foo" if no matching files exist.

letsencrypt.sh

index dc164643b357dfb9ee06e08a117bf8be6084c3a2..040d6224303e413ce5c2f1894e0d77c51355a882 100755 (executable)
@@ -701,6 +701,9 @@ command_cleanup() {
 
       # Loop over all files of this type
       for file in "${certdir}/${filebase}-"*".${fileext}"; do
+        # Handle case where no files match the wildcard
+        [[ -f "${file}" ]] || break
+
         # Check if current file is in use, if unused move to archive directory
         filename="$(basename "${file}")"
         if [[ ! "${filename}" = "${current}" ]]; then