]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut.sh: add --regenerate-all
authorHarald Hoyer <harald@redhat.com>
Wed, 13 Mar 2013 11:46:39 +0000 (12:46 +0100)
committerHarald Hoyer <harald@redhat.com>
Wed, 13 Mar 2013 12:01:33 +0000 (13:01 +0100)
dracut.8.asc
dracut.sh

index 02388e6072eb2be8e0a7b0deccc9a4e1e3d99d39..6a79d122ae10d21565ea627d586effe5f9c180d1 100644 (file)
@@ -409,6 +409,10 @@ will not be able to boot. Equivalent to "--compress=xz --check=crc32
 **--keep**::
     Keep the initramfs temporary directory for debugging purposes.
 
+**--regenerate-all**::
+    Regenerate all initramfs images at the default location with the kernel versions found on the system.
+    Additional parameters are passed through.
+
 FILES
 -----
 _/var/log/dracut.log_::
index bb4929921ecc788a884a68053ac2430bb39612b5..2582f7495ac2c34eeeab80ff832fc2659dcfe626 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -7,7 +7,7 @@
 # of the various mkinitrd implementations out there
 #
 
-# Copyright 2005-2010 Red Hat, Inc.  All rights reserved.
+# Copyright 2005-2013 Red Hat, Inc.  All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -329,6 +329,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
     --long show-modules \
     --long keep \
     --long printsize \
+    --long regenerate-all \
     -- "$@")
 
 if (( $? != 0 )); then
@@ -406,6 +407,7 @@ while :; do
                        ;;
         --keep)        keep="yes";;
         --printsize)   printsize="yes";;
+        --regenerate-all) regenerate_all="yes";;
 
         --) shift; break;;
 
@@ -437,6 +439,33 @@ while (($# > 0)); do
     shift
 done
 
+if [[ $regenerate_all == "yes" ]]; then
+    ret=0
+    if [[ $kernel ]]; then
+        echo "--regenerate-all cannot be called with a kernel version" >&2
+        exit 1
+    fi
+
+    if [[ $outfile ]]; then
+        echo "--regenerate-all cannot be called with a image file" >&2
+        exit 1
+    fi
+
+    ((len=${#dracut_args[@]}))
+    for ((i=0; i < len; i++)); do
+        [[ ${dracut_args[$i]} == "--regenerate-all" ]] && \
+            unset dracut_args[$i]
+    done
+
+    cd /lib/modules
+    for i in *; do
+        [[ -f $i/modules.builtin ]] || continue
+        dracut --kver=$i "${dracut_args[@]}"
+        ((ret+=$?))
+    done
+    exit $ret
+fi
+
 if ! [[ $kernel ]]; then
     kernel=$(uname -r)
 fi