ab0e4d
From 818746166fec7c1e572ef12618edadc0535d4663 Mon Sep 17 00:00:00 2001
ab0e4d
From: Kairui Song <kasong@redhat.com>
ab0e4d
Date: Tue, 9 Jun 2020 03:03:18 +0800
ab0e4d
Subject: [PATCH] dracut.sh: Move the library workaround after squash
ab0e4d
ab0e4d
Ensure the workaround is also valid when dracut-squash module is used
ab0e4d
ab0e4d
Signed-off-by: Kairui Song <kasong@redhat.com>
ab0e4d
(cherry picked from commit de3cb0e3214c3fbab3a94e705445b4d1c2bf0dff)
ab0e4d
ab0e4d
Cherry-picked from: de3cb0e3214c3fbab3a94e705445b4d1c2bf0dff
ab0e4d
Resolves: #1841077
ab0e4d
---
ab0e4d
 dracut.sh | 20 +++++++++++---------
ab0e4d
 1 file changed, 11 insertions(+), 9 deletions(-)
ab0e4d
ab0e4d
diff --git a/dracut.sh b/dracut.sh
ab0e4d
index 487add57..4c5176a1 100755
ab0e4d
--- a/dracut.sh
ab0e4d
+++ b/dracut.sh
ab0e4d
@@ -1578,15 +1578,6 @@ if [[ $kernel_only != yes ]]; then
ab0e4d
     # Now we are done with lazy resolving, always install dependencies
ab0e4d
     unset DRACUT_RESOLVE_LAZY
ab0e4d
     export DRACUT_RESOLVE_DEPS=1
ab0e4d
-
ab0e4d
-    # libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
ab0e4d
-    for _dir in $libdirs; do
ab0e4d
-        for _f in "$_dir/libpthread.so"*; do
ab0e4d
-            [[ -e "$_f" ]] || continue
ab0e4d
-            inst_libdir_file "libgcc_s.so*"
ab0e4d
-            break 2
ab0e4d
-        done
ab0e4d
-    done
ab0e4d
 fi
ab0e4d
 
ab0e4d
 for ((i=0; i < ${#include_src[@]}; i++)); do
ab0e4d
@@ -1840,6 +1831,17 @@ if dracut_module_included "squash"; then
ab0e4d
     done
ab0e4d
 fi
ab0e4d
 
ab0e4d
+if [[ $kernel_only != yes ]]; then
ab0e4d
+    # libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
ab0e4d
+    for _dir in $libdirs; do
ab0e4d
+        for _f in "$dracutsysrootdir$_dir/libpthread.so"*; do
ab0e4d
+            [[ -e "$_f" ]] || continue
ab0e4d
+            inst_libdir_file "libgcc_s.so*"
ab0e4d
+            break 2
ab0e4d
+        done
ab0e4d
+    done
ab0e4d
+fi
ab0e4d
+
ab0e4d
 if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
ab0e4d
     dinfo "*** Stripping files ***"
ab0e4d
     find "$initdir" -type f \
ab0e4d