Blame 0012-add-hardlink-nohardlink-options.patch

Harald Hoyer c4a5a0
From 04d18f558743aa5b3430fe71fc8f9d7facd489ea Mon Sep 17 00:00:00 2001
Harald Hoyer c4a5a0
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer c4a5a0
Date: Sat, 30 Jun 2012 11:34:46 +0200
Harald Hoyer c4a5a0
Subject: [PATCH] add "--hardlink" "--nohardlink" options
Harald Hoyer c4a5a0
Harald Hoyer c4a5a0
---
Harald Hoyer c4a5a0
 dracut.8.asc |   10 ++++++++--
Harald Hoyer c4a5a0
 dracut.sh    |   20 ++++++++++++++------
Harald Hoyer c4a5a0
 2 files changed, 22 insertions(+), 8 deletions(-)
Harald Hoyer c4a5a0
Harald Hoyer c4a5a0
diff --git a/dracut.8.asc b/dracut.8.asc
Harald Hoyer c4a5a0
index bab5996..196e2e8 100644
Harald Hoyer c4a5a0
--- a/dracut.8.asc
Harald Hoyer c4a5a0
+++ b/dracut.8.asc
Harald Hoyer c4a5a0
@@ -183,10 +183,16 @@ example:
Harald Hoyer c4a5a0
     inhibit installation of any fsck tools
Harald Hoyer c4a5a0
 
Harald Hoyer c4a5a0
 **--strip**::
Harald Hoyer c4a5a0
-    strip binaries in the initramfs (default)
Harald Hoyer c4a5a0
+    strip binaries in the initramfs
Harald Hoyer c4a5a0
 
Harald Hoyer c4a5a0
 **--nostrip**::
Harald Hoyer c4a5a0
-    do not strip binaries in the initramfs
Harald Hoyer c4a5a0
+    do not strip binaries in the initramfs (default)
Harald Hoyer c4a5a0
+
Harald Hoyer c4a5a0
+**--hardlink**::
Harald Hoyer c4a5a0
+    hardlink files in the initramfs (default)
Harald Hoyer c4a5a0
+
Harald Hoyer c4a5a0
+**--nohardlink**::
Harald Hoyer c4a5a0
+    do not hardlink files in the initramfs
Harald Hoyer c4a5a0
 
Harald Hoyer c4a5a0
 **--prefix** _<dir>_::
Harald Hoyer c4a5a0
     prefix initramfs files with the specified directory
Harald Hoyer c4a5a0
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer c4a5a0
index 7ca3e8d..4a6d5c7 100755
Harald Hoyer c4a5a0
--- a/dracut.sh
Harald Hoyer c4a5a0
+++ b/dracut.sh
Harald Hoyer c4a5a0
@@ -65,6 +65,8 @@ Creates initial ramdisk images for preloading modules
Harald Hoyer c4a5a0
   --no-kernel           Do not install kernel drivers and firmware files
Harald Hoyer c4a5a0
   --strip               Strip binaries in the initramfs
Harald Hoyer c4a5a0
   --nostrip             Do not strip binaries in the initramfs (default)
Harald Hoyer c4a5a0
+  --hardlink            Hardlink files in the initramfs (default)
Harald Hoyer c4a5a0
+  --nohardlink          Do not hardlink files in the initramfs
Harald Hoyer c4a5a0
   --prefix [DIR]        Prefix initramfs files with [DIR]
Harald Hoyer c4a5a0
   --noprefix            Do not prefix initramfs files (default)
Harald Hoyer c4a5a0
   --mdadmconf           Include local /etc/mdadm.conf
Harald Hoyer c4a5a0
@@ -251,6 +253,8 @@ while (($# > 0)); do
Harald Hoyer c4a5a0
         --no-kernel)   kernel_only="no"; no_kernel="yes";;
Harald Hoyer c4a5a0
         --strip)       do_strip_l="yes";;
Harald Hoyer c4a5a0
         --nostrip)     do_strip_l="no";;
Harald Hoyer c4a5a0
+        --hardlink)    do_hardlink_l="yes";;
Harald Hoyer c4a5a0
+        --nohardlink)  do_hardlink_l="no";;
Harald Hoyer c4a5a0
         --noprefix)    prefix_l="/";;
Harald Hoyer c4a5a0
         --mdadmconf)   mdadmconf_l="yes";;
Harald Hoyer c4a5a0
         --nomdadmconf) mdadmconf_l="no";;
Harald Hoyer c4a5a0
@@ -434,6 +438,9 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
Harald Hoyer c4a5a0
 
Harald Hoyer c4a5a0
 [[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
Harald Hoyer c4a5a0
 [[ $do_strip_l ]] && do_strip=$do_strip_l
Harald Hoyer c4a5a0
+[[ $do_strip ]] || do_strip=no
Harald Hoyer c4a5a0
+[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
Harald Hoyer c4a5a0
+[[ $do_hardlink ]] || do_hardlink=yes
Harald Hoyer c4a5a0
 [[ $prefix_l ]] && prefix=$prefix_l
Harald Hoyer c4a5a0
 [[ $prefix = "/" ]] && unset prefix
Harald Hoyer c4a5a0
 [[ $hostonly_l ]] && hostonly=$hostonly_l
Harald Hoyer c4a5a0
@@ -444,7 +451,6 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
Harald Hoyer c4a5a0
 [[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
Harald Hoyer c4a5a0
 [[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
Harald Hoyer c4a5a0
 [[ $tmpdir ]] || tmpdir=/var/tmp
Harald Hoyer c4a5a0
-[[ $do_strip ]] || do_strip=no
Harald Hoyer c4a5a0
 [[ $compress_l ]] && compress=$compress_l
Harald Hoyer c4a5a0
 [[ $show_modules_l ]] && show_modules=$show_modules_l
Harald Hoyer c4a5a0
 [[ $nofscks_l ]] && nofscks="yes"
Harald Hoyer c4a5a0
@@ -883,11 +889,13 @@ if [[ $do_strip = yes ]] ; then
Harald Hoyer c4a5a0
     dinfo "*** Stripping files done ***"
Harald Hoyer c4a5a0
 fi
Harald Hoyer c4a5a0
 
Harald Hoyer c4a5a0
-type hardlink &>/dev/null && {
Harald Hoyer c4a5a0
-    dinfo "*** hardlinking files ***"
Harald Hoyer c4a5a0
-    hardlink "$initdir" 2>&1
Harald Hoyer c4a5a0
-    dinfo "*** hardlinking files done ***"
Harald Hoyer c4a5a0
-}
Harald Hoyer c4a5a0
+if [[ $do_hardlink = yes ]] ; then
Harald Hoyer c4a5a0
+    type hardlink &>/dev/null && {
Harald Hoyer c4a5a0
+        dinfo "*** hardlinking files ***"
Harald Hoyer c4a5a0
+        hardlink "$initdir" 2>&1
Harald Hoyer c4a5a0
+        dinfo "*** hardlinking files done ***"
Harald Hoyer c4a5a0
+    }
Harald Hoyer c4a5a0
+fi
Harald Hoyer c4a5a0
 
Harald Hoyer c4a5a0
 dinfo "*** Creating image file ***"
Harald Hoyer c4a5a0
 if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \