|
Harald Hoyer |
a20c0e |
From 7d848c55a6a820d19bed0bd498d6081929c128ab Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
a20c0e |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
a20c0e |
Date: Wed, 13 Mar 2013 12:46:39 +0100
|
|
Harald Hoyer |
a20c0e |
Subject: [PATCH] dracut.sh: add --regenerate-all
|
|
Harald Hoyer |
a20c0e |
|
|
Harald Hoyer |
a20c0e |
---
|
|
Harald Hoyer |
a20c0e |
dracut.8.asc | 4 ++++
|
|
Harald Hoyer |
a20c0e |
dracut.sh | 31 ++++++++++++++++++++++++++++++-
|
|
Harald Hoyer |
a20c0e |
2 files changed, 34 insertions(+), 1 deletion(-)
|
|
Harald Hoyer |
a20c0e |
|
|
Harald Hoyer |
a20c0e |
diff --git a/dracut.8.asc b/dracut.8.asc
|
|
Harald Hoyer |
a20c0e |
index 02388e6..6a79d12 100644
|
|
Harald Hoyer |
a20c0e |
--- a/dracut.8.asc
|
|
Harald Hoyer |
a20c0e |
+++ b/dracut.8.asc
|
|
Harald Hoyer |
a20c0e |
@@ -409,6 +409,10 @@ will not be able to boot. Equivalent to "--compress=xz --check=crc32
|
|
Harald Hoyer |
a20c0e |
**--keep**::
|
|
Harald Hoyer |
a20c0e |
Keep the initramfs temporary directory for debugging purposes.
|
|
Harald Hoyer |
a20c0e |
|
|
Harald Hoyer |
a20c0e |
+**--regenerate-all**::
|
|
Harald Hoyer |
a20c0e |
+ Regenerate all initramfs images at the default location with the kernel versions found on the system.
|
|
Harald Hoyer |
a20c0e |
+ Additional parameters are passed through.
|
|
Harald Hoyer |
a20c0e |
+
|
|
Harald Hoyer |
a20c0e |
FILES
|
|
Harald Hoyer |
a20c0e |
-----
|
|
Harald Hoyer |
a20c0e |
_/var/log/dracut.log_::
|
|
Harald Hoyer |
a20c0e |
diff --git a/dracut.sh b/dracut.sh
|
|
Harald Hoyer |
a20c0e |
index bb49299..2582f74 100755
|
|
Harald Hoyer |
a20c0e |
--- a/dracut.sh
|
|
Harald Hoyer |
a20c0e |
+++ b/dracut.sh
|
|
Harald Hoyer |
a20c0e |
@@ -7,7 +7,7 @@
|
|
Harald Hoyer |
a20c0e |
# of the various mkinitrd implementations out there
|
|
Harald Hoyer |
a20c0e |
#
|
|
Harald Hoyer |
a20c0e |
|
|
Harald Hoyer |
a20c0e |
-# Copyright 2005-2010 Red Hat, Inc. All rights reserved.
|
|
Harald Hoyer |
a20c0e |
+# Copyright 2005-2013 Red Hat, Inc. All rights reserved.
|
|
Harald Hoyer |
a20c0e |
#
|
|
Harald Hoyer |
a20c0e |
# This program is free software; you can redistribute it and/or modify
|
|
Harald Hoyer |
a20c0e |
# it under the terms of the GNU General Public License as published by
|
|
Harald Hoyer |
a20c0e |
@@ -329,6 +329,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
|
|
Harald Hoyer |
a20c0e |
--long show-modules \
|
|
Harald Hoyer |
a20c0e |
--long keep \
|
|
Harald Hoyer |
a20c0e |
--long printsize \
|
|
Harald Hoyer |
a20c0e |
+ --long regenerate-all \
|
|
Harald Hoyer |
a20c0e |
-- "$@")
|
|
Harald Hoyer |
a20c0e |
|
|
Harald Hoyer |
a20c0e |
if (( $? != 0 )); then
|
|
Harald Hoyer |
a20c0e |
@@ -406,6 +407,7 @@ while :; do
|
|
Harald Hoyer |
a20c0e |
;;
|
|
Harald Hoyer |
a20c0e |
--keep) keep="yes";;
|
|
Harald Hoyer |
a20c0e |
--printsize) printsize="yes";;
|
|
Harald Hoyer |
a20c0e |
+ --regenerate-all) regenerate_all="yes";;
|
|
Harald Hoyer |
a20c0e |
|
|
Harald Hoyer |
a20c0e |
--) shift; break;;
|
|
Harald Hoyer |
a20c0e |
|
|
Harald Hoyer |
a20c0e |
@@ -437,6 +439,33 @@ while (($# > 0)); do
|
|
Harald Hoyer |
a20c0e |
shift
|
|
Harald Hoyer |
a20c0e |
done
|
|
Harald Hoyer |
a20c0e |
|
|
Harald Hoyer |
a20c0e |
+if [[ $regenerate_all == "yes" ]]; then
|
|
Harald Hoyer |
a20c0e |
+ ret=0
|
|
Harald Hoyer |
a20c0e |
+ if [[ $kernel ]]; then
|
|
Harald Hoyer |
a20c0e |
+ echo "--regenerate-all cannot be called with a kernel version" >&2
|
|
Harald Hoyer |
a20c0e |
+ exit 1
|
|
Harald Hoyer |
a20c0e |
+ fi
|
|
Harald Hoyer |
a20c0e |
+
|
|
Harald Hoyer |
a20c0e |
+ if [[ $outfile ]]; then
|
|
Harald Hoyer |
a20c0e |
+ echo "--regenerate-all cannot be called with a image file" >&2
|
|
Harald Hoyer |
a20c0e |
+ exit 1
|
|
Harald Hoyer |
a20c0e |
+ fi
|
|
Harald Hoyer |
a20c0e |
+
|
|
Harald Hoyer |
a20c0e |
+ ((len=${#dracut_args[@]}))
|
|
Harald Hoyer |
a20c0e |
+ for ((i=0; i < len; i++)); do
|
|
Harald Hoyer |
a20c0e |
+ [[ ${dracut_args[$i]} == "--regenerate-all" ]] && \
|
|
Harald Hoyer |
a20c0e |
+ unset dracut_args[$i]
|
|
Harald Hoyer |
a20c0e |
+ done
|
|
Harald Hoyer |
a20c0e |
+
|
|
Harald Hoyer |
a20c0e |
+ cd /lib/modules
|
|
Harald Hoyer |
a20c0e |
+ for i in *; do
|
|
Harald Hoyer |
a20c0e |
+ [[ -f $i/modules.builtin ]] || continue
|
|
Harald Hoyer |
a20c0e |
+ dracut --kver=$i "${dracut_args[@]}"
|
|
Harald Hoyer |
a20c0e |
+ ((ret+=$?))
|
|
Harald Hoyer |
a20c0e |
+ done
|
|
Harald Hoyer |
a20c0e |
+ exit $ret
|
|
Harald Hoyer |
a20c0e |
+fi
|
|
Harald Hoyer |
a20c0e |
+
|
|
Harald Hoyer |
a20c0e |
if ! [[ $kernel ]]; then
|
|
Harald Hoyer |
a20c0e |
kernel=$(uname -r)
|
|
Harald Hoyer |
a20c0e |
fi
|