From b1df1e98456a7d8492038a8cb56926b8c00994a3 Mon Sep 17 00:00:00 2001 From: JappeHallunken Date: Mon, 22 Jan 2024 20:03:37 +0100 Subject: [PATCH] created a G_BUG_REPORT() function, which prints out the data for the forums troubleshoot template. This info will be also integrated into G_EXEC error handler --- dietpi/func/dietpi-globals | 53 ++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/dietpi/func/dietpi-globals b/dietpi/func/dietpi-globals index 326d8a831b..5e6c35c1e3 100644 --- a/dietpi/func/dietpi-globals +++ b/dietpi/func/dietpi-globals @@ -803,6 +803,28 @@ $grey───────────────────────── return "${result:-1}" } + 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 < "$fp_error_report" +\e[41m --------------------------------------------------------------------- - DietPi has encountered an error - - Please create a ticket: https://github.com/MichaIng/DietPi/issues - @@ -892,15 +915,10 @@ $grey───────────────────────── ---------------------------------------------------------------------\e[44m #### Details: - Date | $(date) -- DietPi version | $dietpi_version -- Image creator | $image_creator -- Pre-image | $preimage_name -- 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}) - Command | \`$ecommand\` - Exit code | $exit_code - Software title | $G_PROGRAM_NAME +$error_details #### Steps to reproduce: 1. ... @@ -918,7 +936,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 :