]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut: add --keep option, to inspect the initramfs directory
authorHarald Hoyer <harald@redhat.com>
Fri, 20 May 2011 18:08:13 +0000 (20:08 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 20 May 2011 18:08:13 +0000 (20:08 +0200)
dracut
dracut.8.xml

diff --git a/dracut b/dracut
index 6f408ee7536013bbf2ae9f0f36e8103ce975253b..5365fbe7b57ee44856a60acd342144b56acd19ac 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -110,6 +110,7 @@ Creates initial ramdisk images for preloading modules
   --list-modules        List all available dracut modules.
   -M, --show-modules    Print included module's name to standard output during
                          build.
+  --keep                Keep the temporary initramfs for debugging purposes
 EOF
 }
 
@@ -240,6 +241,7 @@ while (($# > 0)); do
         -M|--show-modules)
                        show_modules_l="yes"
                        ;;
+        --keep)        keep="yes";;
         -*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
         *)
             if ! [[ ${outfile+x} ]]; then
@@ -455,7 +457,7 @@ readonly TMPDIR=/var/tmp
 readonly initdir=$(mktemp --tmpdir=/var/tmp/ -d -t initramfs.XXXXXX)
 
 # clean up after ourselves no matter how we die.
-trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT
+trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || rm -rf "$initdir";exit $ret;' EXIT
 # clean up after ourselves no matter how we die.
 trap 'exit 1;' SIGINT
 
index 38e1f590e2493e45da12abf50d6f260fb26d2a6a..4cdfe4b5a3e0f00856e4555f169397f98aac673f 100644 (file)
@@ -451,6 +451,14 @@ TARGET directory in the final initramfs. If SOURCE is a file, it will be install
             <para>Print included module's name to standard output during build.</para>
           </listitem>
         </varlistentry>
+        <varlistentry>
+          <term>
+            <option>--keep</option>
+          </term>
+          <listitem>
+            <para>Keep the initramfs temporary directory for debugging purposes.</para>
+          </listitem>
+        </varlistentry>
       </variablelist>
     </refsect2>
   </refsect1>