The last thing fai-cd does in some cases is to move files expanded with
a glob. When creating an autodiscover iso, the program calls itself, and
when it returns, it tries the glob expansion again, but it expands to
nothing, causing the mv to fail. Instead, check that at least one file
exists before doing the move.
---
 bin/fai-cd | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bin/fai-cd b/bin/fai-cd
index a9fc539..8b1882e 100755
--- a/bin/fai-cd
+++ b/bin/fai-cd
@@ -295,7 +295,10 @@ cleanup_liveos_mounts() {
     unhide_dirs
     rm -rf $tmp
     if [ $autodiscover -eq 1 ]; then
-       mv $ONFSROOT/tmp/initrd.img* $ONFSROOT/boot 2>/dev/null
+        local initrdfiles=($ONFSROOT/tmp/initrd.img*)
+        if [[ -e $initrdfiles ]]; then
+           mv "${initrdfiles[@]}" $ONFSROOT/boot 2>/dev/null
+        fi
     fi
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - -
-- 
2.7.4

Reply via email to