From 60ecd582ba56ff6814afbe2e912bc78783988746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= Date: Thu, 8 Aug 2024 15:15:32 +0200 Subject: [PATCH] Improve error reporting for remote deployment Add new method called show_log_and_quit which displays the written error log file as a file box to the user --- dracut/modules.d/90kiwi-dump/kiwi-dump-image.sh | 16 ++++++++-------- dracut/modules.d/99kiwi-lib/kiwi-dialog-lib.sh | 12 ++++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/dracut/modules.d/90kiwi-dump/kiwi-dump-image.sh b/dracut/modules.d/90kiwi-dump/kiwi-dump-image.sh index b7453647c97..52296194af4 100755 --- a/dracut/modules.d/90kiwi-dump/kiwi-dump-image.sh +++ b/dracut/modules.d/90kiwi-dump/kiwi-dump-image.sh @@ -387,25 +387,25 @@ function get_remote_image_source_files { echo "--- ip a ---"; ip a echo "--- ip r ---"; ip r } >> /tmp/fetch.info 2>&1 - report_and_quit \ - "Failed to fetch ${image_md5_uri}, see /tmp/fetch.info" + show_log_and_quit \ + "Failed to fetch ${image_md5_uri}" /tmp/fetch.info fi if ! fetch_file "${image_kernel_uri}" > "${metadata_dir}/linux";then - report_and_quit \ - "Failed to fetch ${image_kernel_uri}, see /tmp/fetch.info" + show_log_and_quit \ + "Failed to fetch ${image_kernel_uri}" /tmp/fetch.info fi if ! fetch_file "${image_initrd_uri}" > "${install_dir}/initrd.system_image" then - report_and_quit \ - "Failed to fetch ${image_initrd_uri}, see /tmp/fetch.info" + show_log_and_quit \ + "Failed to fetch ${image_initrd_uri}" /tmp/fetch.info fi if ! fetch_file "${image_config_uri}" > "/config.bootoptions" then - report_and_quit \ - "Failed to fetch ${image_config_uri}, see /tmp/fetch.info" + show_log_and_quit \ + "Failed to fetch ${image_config_uri}" /tmp/fetch.info fi echo "${image_uri}|${image_md5}" diff --git a/dracut/modules.d/99kiwi-lib/kiwi-dialog-lib.sh b/dracut/modules.d/99kiwi-lib/kiwi-dialog-lib.sh index 1330f870c37..617855a8e1e 100644 --- a/dracut/modules.d/99kiwi-lib/kiwi-dialog-lib.sh +++ b/dracut/modules.d/99kiwi-lib/kiwi-dialog-lib.sh @@ -126,6 +126,18 @@ function _fbiterm_ok { return 0 } +function show_log_and_quit { + local text_message="$1" + local log_file="$2" + run_dialog --timeout 60 --backtitle "\"${text_message}\"" \ + --textbox "${log_file}" 15 80 + if getargbool 0 rd.debug; then + die "${text_message}" + else + reboot -f + fi +} + function report_and_quit { local text_message="$1" run_dialog --timeout 60 --msgbox "\"${text_message}\"" 5 80