dracut/backport-fix-dracut.sh-handle-symlinks-appropriately-while-us.patch
zhangruifang2020 731a2bcd17 backport patchs from upstream
(cherry picked from commit 2e01aee7d2264d9f95b58cf86ca965c343e44027)
2023-12-20 11:12:15 +08:00

32 lines
1.2 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>
---
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" || -h "$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.33.0