Blame SOURCES/0005-Add-option-to-turn-on-off-prelinking.patch

a56a5e
From 96f48da50cdc049c635cca8466b38084a3de0f48 Mon Sep 17 00:00:00 2001
90b079
From: Harald Hoyer <harald@redhat.com>
90b079
Date: Tue, 17 Sep 2013 12:23:20 -0500
90b079
Subject: [PATCH] Add option to turn on/off prelinking
90b079
90b079
--prelink, --noprelink
90b079
90b079
do_prelink=[yes|no]
90b079
---
90b079
 dracut.8.asc      |  6 ++++++
90b079
 dracut.conf.5.asc |  3 +++
90b079
 dracut.sh         | 34 ++++++++++++++++++++++------------
90b079
 3 files changed, 31 insertions(+), 12 deletions(-)
90b079
90b079
diff --git a/dracut.8.asc b/dracut.8.asc
90b079
index ee9d8de..76fc75c 100644
90b079
--- a/dracut.8.asc
90b079
+++ b/dracut.8.asc
90b079
@@ -269,6 +269,12 @@ example:
90b079
 **--nostrip**::
90b079
     do not strip binaries in the initramfs
90b079
 
90b079
+**--prelink**::
90b079
+    prelink binaries in the initramfs (default)
90b079
+
90b079
+**--noprelink**::
90b079
+    do not prelink binaries in the initramfs
90b079
+
90b079
 **--hardlink**::
90b079
     hardlink files in the initramfs (default)
90b079
 
90b079
diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc
90b079
index a32516c..63991d4 100644
90b079
--- a/dracut.conf.5.asc
90b079
+++ b/dracut.conf.5.asc
90b079
@@ -67,6 +67,9 @@ Configuration files must have the extension .conf; other extensions are ignored.
90b079
 *do_strip=*"__{yes|no}__"::
90b079
     Strip binaries in the initramfs (default=yes)
90b079
 
90b079
+*do_prelink=*"__{yes|no}__"::
90b079
+    Prelink binaries in the initramfs (default=yes)
90b079
+
90b079
 *hostonly=*"__{yes|no}__"::
90b079
     Host-Only mode: Install only what is needed for booting the local host
90b079
     instead of a generic host and generate host-specific configuration.
90b079
diff --git a/dracut.sh b/dracut.sh
90b079
index 196b3ad..177e66d 100755
90b079
--- a/dracut.sh
90b079
+++ b/dracut.sh
90b079
@@ -97,6 +97,8 @@ Creates initial ramdisk images for preloading modules
90b079
   --kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
90b079
   --strip               Strip binaries in the initramfs
90b079
   --nostrip             Do not strip binaries in the initramfs
90b079
+  --prelink             Prelink binaries in the initramfs
90b079
+  --noprelink           Do not prelink binaries in the initramfs
90b079
   --hardlink            Hardlink files in the initramfs
90b079
   --nohardlink          Do not hardlink files in the initramfs
90b079
   --prefix [DIR]        Prefix initramfs files with [DIR]
90b079
@@ -315,6 +317,8 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
90b079
     --long kernel-cmdline: \
90b079
     --long strip \
90b079
     --long nostrip \
90b079
+    --long prelink \
90b079
+    --long noprelink \
90b079
     --long hardlink \
90b079
     --long nohardlink \
90b079
     --long noprefix \
90b079
@@ -394,6 +398,8 @@ while :; do
90b079
         --no-early-microcode) early_microcode_l="no";;
90b079
         --strip)       do_strip_l="yes";;
90b079
         --nostrip)     do_strip_l="no";;
90b079
+        --prelink)     do_prelink_l="yes";;
90b079
+        --noprelink)   do_prelink_l="no";;
90b079
         --hardlink)    do_hardlink_l="yes";;
90b079
         --nohardlink)  do_hardlink_l="no";;
90b079
         --noprefix)    prefix_l="/";;
90b079
@@ -651,6 +657,8 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
90b079
 [[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
90b079
 [[ $do_strip_l ]] && do_strip=$do_strip_l
90b079
 [[ $do_strip ]] || do_strip=yes
90b079
+[[ $do_prelink_l ]] && do_prelink=$do_prelink_l
90b079
+[[ $do_prelink ]] || do_prelink=yes
90b079
 [[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
90b079
 [[ $do_hardlink ]] || do_hardlink=yes
90b079
 [[ $prefix_l ]] && prefix=$prefix_l
90b079
@@ -1251,18 +1259,20 @@ if [[ $kernel_only != yes ]]; then
90b079
     fi
90b079
 fi
90b079
 
90b079
-PRELINK_BIN="$(command -v prelink)"
90b079
-if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
90b079
-    if [[ $DRACUT_FIPS_MODE ]]; then
90b079
-        dinfo "*** Installing prelink files ***"
90b079
-        inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
90b079
-    else
90b079
-        dinfo "*** Pre-linking files ***"
90b079
-        inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
90b079
-        chroot "$initdir" "$PRELINK_BIN" -a
90b079
-        rm -f -- "$initdir/$PRELINK_BIN"
90b079
-        rm -fr -- "$initdir"/etc/prelink.*
90b079
-        dinfo "*** Pre-linking files done ***"
90b079
+if [[ $do_prelink == yes ]]; then
90b079
+    PRELINK_BIN="$(command -v prelink)"
90b079
+    if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
90b079
+        if [[ $DRACUT_FIPS_MODE ]]; then
90b079
+            dinfo "*** Installing prelink files ***"
90b079
+            inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
90b079
+        else
90b079
+            dinfo "*** Pre-linking files ***"
90b079
+            inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
90b079
+            chroot "$initdir" "$PRELINK_BIN" -a
90b079
+            rm -f -- "$initdir/$PRELINK_BIN"
90b079
+            rm -fr -- "$initdir"/etc/prelink.*
90b079
+            dinfo "*** Pre-linking files done ***"
90b079
+        fi
90b079
     fi
90b079
 fi
90b079