]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(dracut.sh): handle symlinks appropriately while using '-i' option
authorKairui Song <kasong@redhat.com>
Fri, 11 Jun 2021 18:25:09 +0000 (02:25 +0800)
committerHarald Hoyer <harald@hoyer.xyz>
Tue, 29 Jun 2021 07:53:19 +0000 (09:53 +0200)
[[ -d $symlink ]] will return true if the symlink points to a directory.
So the symlink will not be copied, instead a directory is created with
the symlink name and the content is copied.

Signed-off-by: Kairui Song <kasong@redhat.com>
dracut.sh

index e7f47752c25e674b86fe5c5086075562d04c076f..78917763b627df034eccbb0251ddc1313aea3e48 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -2071,7 +2071,7 @@ for ((i = 0; i < ${#include_src[@]}; i++)); do
             shopt -q -s dotglob
             for objectname in "$src"/*; do
                 [[ -e $objectname || -L $objectname ]] || continue
-                if [[ -d $objectname ]]; then
+                if [[ -d $objectname ]] && [[ ! -L $objectname ]]; then
                     # objectname is a directory, let's compute the final directory name
                     object_destdir=${destdir}/${objectname#$src/}
                     if ! [[ -e $object_destdir ]]; then