Blob Blame History Raw
From d77540c8e4caf557d472786711ef17838a4a24f1 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 4 Jun 2012 15:23:15 +0200
Subject: [PATCH] get rid of libdir and usrlibdir

---
 dracut.sh                                        |   23 ++++++++--------------
 modules.d/01fips/module-setup.sh                 |    2 +-
 modules.d/50plymouth/plymouth-populate-initrd.sh |   12 ++++-------
 modules.d/95nfs/module-setup.sh                  |    8 +++-----
 4 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/dracut.sh b/dracut.sh
index c9e412e..65398a8 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -527,22 +527,15 @@ ddebug "Executing $0 $dracut_args"
 }
 
 # Detect lib paths
-if ! [[ $libdir ]] || ! [[ $usrlibdir ]] ; then
+if ! [[ $libdirs ]] ; then
     if strstr "$(ldd /bin/sh)" "/lib64/" &>/dev/null \
         && [[ -d /lib64 ]]; then
-        libdir=/lib64
-        usrlibdir=/usr/lib64
+        libdirs+=" /lib64"
+        [[ -d /usr/lib64 ]] && libdirs+=" /usr/lib64"
     else
-        libdir=/lib
-        usrlibdir=/usr/lib
+        libdirs+=" /lib"
+        [[ -d /usr/lib ]] && libdirs+=" /usr/lib"
     fi
-    for i in $libdir $usrlibdir; do
-        if [[ -d $i ]]; then
-            libdirs+=" $i"
-        else
-            dwarn 'No $i directory??!!'
-        fi
-    done
 fi
 
 # This is kinda legacy -- eventually it should go away.
@@ -660,7 +653,7 @@ done
 export initdir dracutbasedir dracutmodules drivers \
     fw_dir drivers_dir debug no_kernel kernel_only \
     add_drivers omit_drivers mdadmconf lvmconf filesystems \
-    use_fstab fstab_lines libdir usrlibdir fscks nofscks \
+    use_fstab fstab_lines libdirs fscks nofscks \
     stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
     debug host_fs_types host_devs sshkey add_fstab \
     DRACUT_VERSION
@@ -672,13 +665,13 @@ export initdir dracutbasedir dracutmodules drivers \
 [[ $prefix ]] && ln -sfn "${prefix#/}/lib" "$initdir/lib"
 
 if [[ $prefix ]]; then
-    for d in bin etc lib "$libdir" sbin tmp usr var; do
+    for d in bin etc lib $libdirs sbin tmp usr var; do
         ln -sfn "${prefix#/}/${d#/}" "$initdir/$d"
     done
 fi
 
 if [[ $kernel_only != yes ]]; then
-    for d in usr/bin usr/sbin bin etc lib "$libdir" sbin tmp usr var var/log var/run var/lock; do
+    for d in usr/bin usr/sbin bin etc lib $libdirs sbin tmp usr var var/log var/run var/lock; do
         [[ -e "${initdir}${prefix}/$d" ]] && continue
         if [ -L "/$d" ]; then
             inst_symlink "/$d" "${prefix}/$d"
diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh
index 075fc24..a576a4a 100755
--- a/modules.d/01fips/module-setup.sh
+++ b/modules.d/01fips/module-setup.sh
@@ -41,7 +41,7 @@ install() {
     inst_libdir_file libfreebl3.so
     inst_libdir_file libfreebl3.chk
 
-    dracut_install $usrlibdir/hmaccalc/sha512hmac.hmac
+    inst_libdir_file 'hmaccalc/sha512hmac.hmac'
     if command -v prelink >/dev/null; then
         dracut_install prelink
     fi
diff --git a/modules.d/50plymouth/plymouth-populate-initrd.sh b/modules.d/50plymouth/plymouth-populate-initrd.sh
index 25657ae..7ab1a5d 100755
--- a/modules.d/50plymouth/plymouth-populate-initrd.sh
+++ b/modules.d/50plymouth/plymouth-populate-initrd.sh
@@ -12,8 +12,8 @@ dracut_install /bin/plymouth \
 mkdir -m 0755 -p "${initdir}/usr/share/plymouth"
 
 if [[ $hostonly ]]; then
-    dracut_install "${usrlibdir}/plymouth/text.so" \
-        "${usrlibdir}/plymouth/details.so" \
+    inst_libdir_file "plymouth/text.so" "plymouth/details.so"
+    dracut_install \
         "/usr/share/plymouth/themes/details/details.plymouth" \
         "/usr/share/plymouth/themes/text/text.plymouth" \
 
@@ -28,7 +28,7 @@ if [[ $hostonly ]]; then
         inst /usr/share/plymouth/themes/default.plymouth
         # Install plugin for this theme
         PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c; do echo $b; done;)
-        inst "${usrlibdir}/plymouth/${PLYMOUTH_PLUGIN}.so"
+        inst_libdir_file "plymouth/${PLYMOUTH_PLUGIN}.so"
     fi
 else
     for x in /usr/share/plymouth/themes/{text,details}/* ; do
@@ -37,11 +37,7 @@ else
         mkdir -m 0755 -p "${initdir}/$THEME_DIR"
         dracut_install "$x"
     done
-    for x in "${usrlibdir}"/plymouth/{text,details}.so ; do
-        [[ -f "$x" ]] || continue
-        [[ "$x" != "${x%%/label.so}" ]] && continue
-        dracut_install "$x"
-    done
+    inst_libdir_file "/plymouth/{text,details}.so"
     (
         cd ${initdir}/usr/share/plymouth/themes;
         ln -s text/text.plymouth default.plymouth 2>&1;
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index 1d62e95..bf87762 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -43,11 +43,9 @@ install() {
     dracut_install rpc.idmapd
     dracut_install sed
 
-    for _i in {"$libdir","$usrlibdir"}/libnfsidmap_nsswitch.so* \
-        {"$libdir","$usrlibdir"}/libnfsidmap/*.so \
-        {"$libdir","$usrlibdir"}/libnfsidmap*.so*; do
-        [ -e "$_i" ] && dracut_install "$_i"
-    done
+    inst_libdir_file 'libnfsidmap_nsswitch.so*'
+    inst_libdir_file 'libnfsidmap/*.so'
+    inst_libdir_file 'libnfsidmap*.so*'
 
     _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
         |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')