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