dracut/backport-fix-dracut.sh-handle-symlinks-appropriately-while-us.patch
hongjinghao 9d9fb131b3 backport patchs from upstream
(cherry picked from commit 74c55dc789a3aacb444c42ab40cd308bd213f5e3)
2024-02-22 16:48:54 +08:00

35 lines
1.3 KiB
Diff

From c7fbc0c8901917baf0d1f0822568e65c6ec00d18 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Sat, 12 Jun 2021 02:25:09 +0800
Subject: [PATCH] fix(dracut.sh): handle symlinks appropriately while using
'-i' option
[[ -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>
Reference:https://github.com/dracutdevs/dracut/commit/c7fbc0c8901917baf0d1f0822568e65c6ec00d18
Conflict:NA
---
dracut.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut.sh b/dracut.sh
index e7f47752..78917763 100755
--- 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
--
2.27.0