]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix: correct the squash quirk
authorHarald Hoyer <harald@redhat.com>
Tue, 9 Feb 2021 15:34:35 +0000 (16:34 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Wed, 10 Feb 2021 13:14:39 +0000 (14:14 +0100)
Previously with `no_kernel` the `for` loop errored on the modules
wildcard. By checking, if the file exists, this is mitigated.

"mv" asked interactively, if aliased in the user session, so a "--force"
was added.

dracut.sh

index a6cbc3dd9319f1a5a233b2bdabce50dfa744fa50..60d5c0ac50e1ec267f2f4157816ebea4ec8fb45b 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -2007,7 +2007,7 @@ if dracut_module_included "squash"; then
         $squash_dir/usr/lib/dracut/* \
         $squash_dir/etc/initrd-release
     do
-        [[ -d $file ]] && continue
+        [[ -f $file ]] || continue
         DRACUT_RESOLVE_DEPS=1 dracutsysrootdir=$squash_dir inst ${file#$squash_dir}
         rm $file
     done
@@ -2029,7 +2029,7 @@ if dracut_module_included "squash"; then
     for folder in "${squash_candidate[@]}"; do
         for file in $(find $initdir/$folder/ -not -type d); do
             if [[ -e $squash_dir${file#$initdir} ]]; then
-                mv $squash_dir${file#$initdir} $file
+                mv -f $squash_dir${file#$initdir} $file
             fi
         done
     done