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

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