From 8767a8796aed16c9e75ad048c36b1985c272b0ad Mon Sep 17 00:00:00 2001 From: JappeHallunken Date: Mon, 22 Jan 2024 19:49:29 +0100 Subject: [PATCH] create a G_BUG_REPORT function, which can be executed to generate the troubleshoot template for the forum. This info will also be integrated into G_EXEC, when one of the dietpi-* scripts error out. --- dietpi/func/dietpi-globals | 54 ++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 2f0fe36df9..379c54a018 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -804,6 +804,31 @@ $grey───────────────────────── return "${result:-1}" } +<<<<<<< HEAD +======= + G_BUG_REPORT() { + local dietpi_version="v$G_DIETPI_VERSION_CORE.$G_DIETPI_VERSION_SUB.$G_DIETPI_VERSION_RC ($G_GITOWNER/$G_GITBRANCH)" + local image_creator preimage_name + + if [[ -f '/boot/dietpi/.prep_info' ]]; then + image_creator=$(mawk 'NR==1' /boot/dietpi/.prep_info) + [[ $image_creator == 0 ]] && image_creator='DietPi Core Team' + preimage_name=$(mawk 'NR==2' /boot/dietpi/.prep_info) + fi + + cat <>>>>>> 7f106513 (create a G_BUG_REPORT function, which can be executed to generate the troubleshoot template for the forum.) #----------------------------------------------------------------------------------- # Error handled command execution wrapper #----------------------------------------------------------------------------------- @@ -874,24 +899,26 @@ $grey───────────────────────── # Exit retry loop if $G_EXEC_NOHALT=1 is given [[ $G_EXEC_NOHALT == 1 ]] && break - # Prepare error handler menu and GitHub issue template - local fp_error_report='/tmp/G_EXEC_ERROR_REPORT' log_content=$(<"$fp_log") image_creator preimage_name dietpi_version="v$G_DIETPI_VERSION_CORE.$G_DIETPI_VERSION_SUB.$G_DIETPI_VERSION_RC ($G_GITOWNER/$G_GITBRANCH)" last_whip_menu_item sent_bug_report - if [[ -f '/boot/dietpi/.prep_info' ]]; then - - image_creator=$(mawk 'NR==1' /boot/dietpi/.prep_info) - [[ $image_creator == 0 ]] && image_creator='DietPi Core Team' - preimage_name=$(mawk 'NR==2' /boot/dietpi/.prep_info) + # Prepare error handler menu and GitHub issue template + local fp_error_report='/tmp/G_EXEC_ERROR_REPORT' log_content=$(<"$fp_log") last_whip_menu_item sent_bug_report + if [[ -f '/boot/dietpi/.prep_info' ]]; then + image_creator=$(mawk 'NR==1' /boot/dietpi/.prep_info) + [[ $image_creator == 0 ]] && image_creator='DietPi Core Team' + preimage_name=$(mawk 'NR==2' /boot/dietpi/.prep_info) + fi - fi + local dietpi_version="v$G_DIETPI_VERSION_CORE.$G_DIETPI_VERSION_SUB.$G_DIETPI_VERSION_RC ($G_GITOWNER/$G_GITBRANCH)" + local error_details=$(generate_error_details "$dietpi_version") - # Create GitHub issue template if error was produced by one of our scripts - [[ ${G_PROGRAM_NAME,,} == 'dietpi-'* ]] && echo -e "\e[41m + cat < "$fp_error_report" +\e[41m --------------------------------------------------------------------- - DietPi has encountered an error - - Please create a ticket: https://github.com/MichaIng/DietPi/issues - - Copy and paste only the BLUE lines below into the ticket - ---------------------------------------------------------------------\e[44m #### Details: +<<<<<<< HEAD - Date | $(date) - DietPi version | $dietpi_version - Image creator | $image_creator @@ -899,6 +926,10 @@ $grey───────────────────────── - Hardware | $G_HW_MODEL_NAME (ID=$G_HW_MODEL) - Kernel version | \`$(uname -a)\` - Distro | $G_DISTRO_NAME (ID=$G_DISTRO${G_RASPBIAN:+,RASPBIAN=$G_RASPBIAN}) +======= +$error_details +- Date | $(date) +>>>>>>> 7f106513 (create a G_BUG_REPORT function, which can be executed to generate the troubleshoot template for the forum.) - Command | \`$ecommand\` - Exit code | $exit_code - Software title | $G_PROGRAM_NAME @@ -919,7 +950,8 @@ $grey───────────────────────── \`\`\` $log_content \`\`\`\e[41m ----------------------------------------------------------------------\e[0m" > "$fp_error_report" +---------------------------------------------------------------------\e[0m +EOF # Enter error handler menu loop in interactive mode [[ $G_INTERACTIVE == 1 ]] && while :