On 29/03/19 11:12 AM, Kairui Song wrote:
Use "kdumpctl rebuild" to rebuild the image directly. This
could help
admins to rebuild kdump image directly.
Also merge fadump related initramfs backup/restore into setup_initrd,
and do permission only when actually trying to rebuild the image.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdumpctl | 51 +++++++++++++++++++++++++++++----------------------
1 file changed, 29 insertions(+), 22 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 1cfbe31..ac6ddee 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -123,6 +123,11 @@ rebuild_kdump_initrd()
rebuild_initrd()
{
+ if [[ ! -w "$KDUMP_BOOTDIR" ]];then
+ echo "$KDUMP_BOOTDIR does not have write permission. Can not rebuild
$TARGET_INITRD"
+ return 1
+ fi
+
if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
rebuild_fadump_initrd
else
@@ -302,8 +307,17 @@ setup_initrd()
echo "Error: No initrd found to rebuild!"
return 1
fi
Hi Kairui,
Looks good to me except that the below snippet from setup_initrd() seems
to be dropped:
- if [ ! -s "$TARGET_INITRD" ]; then
- echo "Error: No initrd found to rebuild!"
- return 1
- fi
As noted earlier, with commit da6b75f59bdd ("fadump: use the original initrd
to rebuild fadump initrdfrom"), error check in setup_initrd() is no longer
needed..
Thanks
Hari