summaryrefslogtreecommitdiff
path: root/dracut.sh
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-03-13 12:46:39 +0100
committerHarald Hoyer <harald@redhat.com>2013-03-13 13:01:33 +0100
commit7d848c55a6a820d19bed0bd498d6081929c128ab (patch)
treefdf76faf3c49bd0f617b3a04588af2dcfc4765f2 /dracut.sh
parent7d17d6c976d705deebf3da46fd546b1fe7e1dd65 (diff)
downloaddracut-7d848c55a6a820d19bed0bd498d6081929c128ab.tar.gz
dracut-7d848c55a6a820d19bed0bd498d6081929c128ab.tar.bz2
dracut-7d848c55a6a820d19bed0bd498d6081929c128ab.zip
dracut.sh: add --regenerate-all
Diffstat (limited to 'dracut.sh')
-rwxr-xr-xdracut.sh31
1 files changed, 30 insertions, 1 deletions
diff --git a/dracut.sh b/dracut.sh
index bb492992..2582f749 100755
--- 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