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

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