Blob Blame History Raw
From 10f8df1bdfd0a19a0415e7db18b1a071313f0e57 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 13 Nov 2015 11:53:36 +0100
Subject: [PATCH] add --no-reproducible to turn off reproducible mode

Also warn about cpio not supporting it and turn it on by default for
fedora.
---
 dracut.conf.d/fedora.conf.example | 1 +
 dracut.sh                         | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example
index b126b09..b32abb0 100644
--- a/dracut.conf.d/fedora.conf.example
+++ b/dracut.conf.d/fedora.conf.example
@@ -17,3 +17,4 @@ udevdir=/usr/lib/udev
 hostonly="yes"
 hostonly_cmdline="no"
 early_microcode="yes"
+reproducible="yes"
diff --git a/dracut.sh b/dracut.sh
index 1f75b24..fb5d400 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -202,6 +202,7 @@ Creates initial ramdisk images for preloading modules
   --sshkey [SSHKEY]     Add ssh key to initramfs (use with ssh-client module)
   --logfile [FILE]      Logfile to use (overrides configuration setting)
   --reproducible        Create reproducible images
+  --no-reproducible     Do not create reproducible images
   --loginstall [DIR]    Log all files installed from the host to [DIR]
   --uefi                Create an UEFI executable with the kernel cmdline and
                         kernel combined
@@ -358,6 +359,7 @@ rearrange_params()
         --long early-microcode \
         --long no-early-microcode \
         --long reproducible \
+        --long no-reproducible \
         --long loginstall: \
         --long uefi \
         --long uefi-stub: \
@@ -553,6 +555,7 @@ while :; do
         --regenerate-all) regenerate_all="yes";;
         --noimageifnotneeded) noimageifnotneeded="yes";;
         --reproducible) reproducible_l="yes";;
+        --no-reproducible) reproducible_l="no";;
         --uefi)        uefi="yes";;
         --uefi-stub)
                        uefi_stub_l="$2";               PARMS_TO_STORE+=" '$2'"; shift;;
@@ -1673,7 +1676,11 @@ if [[ $DRACUT_REPRODUCIBLE ]]; then
     find "$initdir" -newer "$dracutbasedir/dracut-functions.sh" -print0 \
         | xargs -r -0 touch -h -m -c -r "$dracutbasedir/dracut-functions.sh"
 
-    [[ "$(cpio --help)" == *--reproducible* ]] && CPIO_REPRODUCIBLE=1
+    if [[ "$(cpio --help)" == *--reproducible* ]]; then
+        CPIO_REPRODUCIBLE=1
+    else
+        dinfo "cpio does not support '--reproducible'. Resulting image will not be reproducible."
+    fi
 fi
 
 [[ "$UID" != 0 ]] && cpio_owner_root="-R 0:0"