quarks/sys-kernel/dracut/files/gentoo-ldconfig-paths.patch

40 lines
1.4 KiB
Diff
Raw Normal View History

From 0674b9136831b1beb6a7ec91147fd5c280c693a3 Mon Sep 17 00:00:00 2001
From: Alexander Tsoy <alexander@tsoy.me>
Date: Mon, 9 Mar 2020 02:47:07 +0300
Subject: [PATCH] Remove redundant gcc paths in ldconfig_paths()
Bug: https://bugs.gentoo.org/705728
---
dracut-functions.sh | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 3cb9c7af..5337ff6c 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -76,7 +76,20 @@ find_binary() {
ldconfig_paths()
{
- $DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
+ local gccpath
+
+ if type -P gcc-config &>/dev/null; then
+ gccpath=$(gcc-config -c)
+ gccpath=/usr/lib/gcc/${gccpath%-*}/${gccpath##*-}
+ fi
+
+ while read -r line; do
+ if [[ ${line} != /usr/lib/gcc/* || -z ${gccpath} ]]; then
+ echo ${line}
+ elif [[ ${line} == ${gccpath} ]]; then
+ echo ${line}
+ fi
+ done < <($DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq)
}
# Version comparision function. Assumes Linux style version scheme.
--
2.24.1