From 2edc75c44c2bc4106dcd5588f73b516771882b88 Mon Sep 17 00:00:00 2001 From: Tearran Date: Sat, 1 Feb 2025 20:04:41 +0000 Subject: [PATCH 01/18] add check point timer module --- .../modules/initialize/message_checkpoint.sh | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 tools/modules/initialize/message_checkpoint.sh diff --git a/tools/modules/initialize/message_checkpoint.sh b/tools/modules/initialize/message_checkpoint.sh new file mode 100644 index 000000000..2e0e50c7f --- /dev/null +++ b/tools/modules/initialize/message_checkpoint.sh @@ -0,0 +1,67 @@ + +module_options+=( + ["set_checkpoint,author"]="@armbian" + ["set_checkpoint,maintainer"]="@igorpecovnik" + ["set_checkpoint,feature"]="set_checkpoint" + ["set_checkpoint,example"]="help start mark stop show" + ["set_checkpoint,desc"]="Helper module for timing code execution" + ["set_checkpoint,status"]="" + ["set_checkpoint,doc_link"]="" + ["set_checkpoint,group"]="Development" + ["set_checkpoint,port"]="" + ["set_checkpoint,arch"]="x86-64 arm64" +) +# +# Function to manage timer with multiple checkpoints +function set_checkpoint() { + case "$1" in + help) + echo "Usage: set_checkpoint [description] [show]" + echo "Commands:" + echo " start Start the timer." + echo " stop Stop the timer." + echo " mark [description] [time] Mark a checkpoint with an optional description and an optional flag to show the output." + echo " show Show the total elapsed time and checkpoints." + ;; + start) + set_checkpoint_START=$(date +%s) + set_checkpoint_CHECKPOINTS=() + set_checkpoint_DESCRIPTIONS=() + set_checkpoint_PREV=$set_checkpoint_START + ;; + stop) + set_checkpoint_STOP=$(date +%s) + ;; + mark) + local checkpoint_time=$(date +%s) + local checkpoint_duration=$((checkpoint_time - set_checkpoint_PREV)) + set_checkpoint_PREV=$checkpoint_time + set_checkpoint_CHECKPOINTS+=($checkpoint_time) + set_checkpoint_DESCRIPTIONS+=("$2") + local count=${#set_checkpoint_DESCRIPTIONS[@]} + if [[ "$3" == "true" && $UXMODE == "true" ]]; then + printf "%-30s %10d seconds\n" "$2:" "${checkpoint_duration}" + fi + ;; + show) + if [[ -n "$set_checkpoint_START" && -n "$set_checkpoint_STOP" ]]; then + set_checkpoint_DURATION=$((set_checkpoint_STOP - set_checkpoint_START)) + printf "%-30s: %d seconds\n" "Total elapsed time" "${set_checkpoint_DURATION}" + + local previous_time=$set_checkpoint_START + for i in "${!set_checkpoint_CHECKPOINTS[@]}"; do + local checkpoint_time=${set_checkpoint_CHECKPOINTS[$i]} + local checkpoint_duration=$((checkpoint_time - previous_time)) + local description=${set_checkpoint_DESCRIPTIONS[$i]} + printf "%-30s: %d seconds\n" "${description:-Checkpoint $((i+1))}" "${checkpoint_duration}" + previous_time=$checkpoint_time + done + else + echo "Timer has not been started and stopped properly." + fi + ;; + *) + echo "Usage: set_checkpoint [description]" + ;; + esac +} From 622ead68fa8b3ff0b0d58d1e337138166068e885 Mon Sep 17 00:00:00 2001 From: Tearran Date: Sat, 1 Feb 2025 20:05:36 +0000 Subject: [PATCH 02/18] updated main to se checkpoint timer --- bin/armbian-config | 54 +++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/bin/armbian-config b/bin/armbian-config index ea10907eb..82d7ddea5 100755 --- a/bin/armbian-config +++ b/bin/armbian-config @@ -3,10 +3,6 @@ # initializes the terminal from TERM if stdin is a terminal [[ -t 0 ]] && tput init -# Language-based variable assignment for script directory path -# This serves as a Rosetta Stone for developers, -# allowing them to use the variable name they are most comfortable with. - # allows CTRL c to exit trap "exit" INT TERM [[ $EUID != 0 ]] && exec sudo "$0" "$@" @@ -14,6 +10,27 @@ trap "exit" INT TERM # Get the script directory script_dir="$(dirname "$0")" +declare -A module_options + +# Conditional settings based on arguments +# for interactive vs non-interactive modes +if [[ "$1" == "--api" || "$1" == "--doc" ]]; then + UXMODE="false" +elif [[ -z "$1" || "$1" == "--cmd" || "$1" == "--help" ]]; then + UXMODE="true" +fi + +# Additional check for interactive vs non-interactive mode +if [[ ! -t 0 ]]; then + UXMODE="false" +fi + +# Load the initialize modules +source "$script_dir/../lib/armbian-config/config.initialize.sh" + +set_checkpoint start +set_checkpoint mark "Initializing script" true + [[ -d "$script_dir/../tools" ]] && tools_dir="$script_dir/../tools" [[ ! -d "$script_dir/../lib" && -n "$tools_dir" ]] && echo -e "Please run\nbash "$tools_dir/config-assemble.sh" to build the lib directory\n" && exit 1 @@ -29,32 +46,29 @@ json_file="$lib_dir/config.jobs.json" # Load The Bash procedure Objects json_data=$(<"$json_file") -# -# Prepare the module options array -declare -A module_options -# # Load configng core functions and module options array source "$lib_dir/config.functions.sh" set_runtime_variables -check_distro_status -echo "Loaded Runtime variables..." #| show_infobox ; -#set_newt_colors 2 -echo "Loaded Dialog..." #| show_infobox ; +set_checkpoint mark "Loaded Runtime variables..." true +# checks for supported os +set_checkpoint mark "$(check_distro_status)" true + +set_checkpoint mark "Loaded Dialog..." true source "$lib_dir/config.docs.sh" -echo "Loaded Docs..." #| show_infobox ; +set_checkpoint mark "Loaded Docs..." true source "$lib_dir/config.system.sh" -echo "Loaded System helpers..." #| show_infobox ; +set_checkpoint mark "Loaded System helpers..." true source "$lib_dir/config.network.sh" -echo "Loaded Network helpers..." #| show_infobox ; +set_checkpoint mark "Loaded Network helpers..." true source "$lib_dir/config.software.sh" -echo "Loaded Software helpers..." #| show_infobox ; +set_checkpoint mark "Loaded Software helpers..." true # # Loads the variables from beta armbian-config for runtime handling source "$lib_dir/config.runtime.sh" -echo "Loaded Runtime conditions..." #| show_infobox ; +echo "Loaded Runtime conditions..." true clear @@ -85,7 +99,6 @@ case "$1" in exit 0 ;; "--cmd") - INPUTMODE="cmd" shift if [[ -z "$1" || "$1" == "help" ]]; then see_cmd_list @@ -104,9 +117,9 @@ case "$1" in fi option="$1" shift - args=$(sanitize_input "$@") + # echo -e "\"$option\" \"$args\"" - "$option" "$args" + "$option" "$@" exit 0 ;; "main=help" | "main=Help") @@ -171,3 +184,4 @@ generate_top_menu "$json_data" about_armbian_configng exit 0 + From 651f73b1e2951837c482c0ab1b20a2d450757f53 Mon Sep 17 00:00:00 2001 From: Tearran Date: Sat, 1 Feb 2025 20:14:07 +0000 Subject: [PATCH 03/18] cp armbian-config to tools/armbian-config-dev --- tools/armbian-config-dev | 187 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100755 tools/armbian-config-dev diff --git a/tools/armbian-config-dev b/tools/armbian-config-dev new file mode 100755 index 000000000..82d7ddea5 --- /dev/null +++ b/tools/armbian-config-dev @@ -0,0 +1,187 @@ +#!/bin/bash + +# initializes the terminal from TERM if stdin is a terminal +[[ -t 0 ]] && tput init + +# allows CTRL c to exit +trap "exit" INT TERM +[[ $EUID != 0 ]] && exec sudo "$0" "$@" +# +# Get the script directory +script_dir="$(dirname "$0")" + +declare -A module_options + +# Conditional settings based on arguments +# for interactive vs non-interactive modes +if [[ "$1" == "--api" || "$1" == "--doc" ]]; then + UXMODE="false" +elif [[ -z "$1" || "$1" == "--cmd" || "$1" == "--help" ]]; then + UXMODE="true" +fi + +# Additional check for interactive vs non-interactive mode +if [[ ! -t 0 ]]; then + UXMODE="false" +fi + +# Load the initialize modules +source "$script_dir/../lib/armbian-config/config.initialize.sh" + +set_checkpoint start +set_checkpoint mark "Initializing script" true + +[[ -d "$script_dir/../tools" ]] && tools_dir="$script_dir/../tools" +[[ ! -d "$script_dir/../lib" && -n "$tools_dir" ]] && echo -e "Please run\nbash "$tools_dir/config-assemble.sh" to build the lib directory\n" && exit 1 + +# 'whiptail' is a simple dialog box utility that works well with Bash. It doesn't have all the features of some other dialog box utilities, but it does everything we need for this script. +[[ -x "$(command -v whiptail)" ]] && DIALOG="whiptail" + +# Define the lib directory one level up from the script directory +lib_dir="$script_dir/../lib/armbian-config" +doc_dir="$script_dir/../share/doc/armbian-config" +json_file="$lib_dir/config.jobs.json" + +# +# Load The Bash procedure Objects +json_data=$(<"$json_file") + + +# Load configng core functions and module options array + +source "$lib_dir/config.functions.sh" +set_runtime_variables +set_checkpoint mark "Loaded Runtime variables..." true +# checks for supported os +set_checkpoint mark "$(check_distro_status)" true + +set_checkpoint mark "Loaded Dialog..." true +source "$lib_dir/config.docs.sh" +set_checkpoint mark "Loaded Docs..." true +source "$lib_dir/config.system.sh" +set_checkpoint mark "Loaded System helpers..." true +source "$lib_dir/config.network.sh" +set_checkpoint mark "Loaded Network helpers..." true +source "$lib_dir/config.software.sh" +set_checkpoint mark "Loaded Software helpers..." true +# +# Loads the variables from beta armbian-config for runtime handling + +source "$lib_dir/config.runtime.sh" +echo "Loaded Runtime conditions..." true + +clear + +case "$1" in +"--help") + if [[ -n "$2" ]]; then + see_cmd_list "$2" + echo "" + exit 0 + fi + + echo "Usage: armbian-config --[option] + Options: + --help [category] Use [category] to filter specific menu options. + --cmd [option] Run a command from the menu (simple) + --api [option] Run a helper command (advanced) + --doc Generate the README.md file + + Examples: + armbian-config --help [cmd||System||Software||Network||Localisation] + armbian-config --cmd help + armbian-config --api help +" + exit 0 + ;; +"--doc") + generate_readme + exit 0 + ;; +"--cmd") + shift + if [[ -z "$1" || "$1" == "help" ]]; then + see_cmd_list + exit 0 + fi + + args=$(sanitize_input "$@") + execute_command "$args" + exit 0 + ;; +"--api") + shift + if [[ -z "$1" || "$1" == "help" ]]; then + see_use + exit 0 + fi + option="$1" + shift + + # echo -e "\"$option\" \"$args\"" + "$option" "$@" + exit 0 + ;; +"main=help" | "main=Help") + see_cli_legacy + echo "" + exit 0 + ;; +"main="*) + declare -A main_map + main_map=( + # map name to menu category + ["System"]="S" + ["Software"]="I" + ["Network"]="N" + ["Localisation"]="L" + ) + main_value="${1#main=}" + main_value="${main_map[$main_value]}" + + if [ -z "$main_value" ]; then + echo "Error: Invalid List $1" + exit 1 + fi + declare -A select_map + # map name to menu number + select_map=( + ["Headers"]="04" + ["Headers_install"]="04" + ["Headers_remove"]="05" + ["Firmware"]="06" + ["Nightly"]="07" + ) + select_value="${2#selection=}" + select_value="${select_map[$select_value]}" + if [ -z "$select_value" ]; then + echo "Error: Invalid Option $2" + exit 1 + fi + echo "$main_value""$select_value" + execute_command "$main_value""$select_value" + exit 0 + ;; +*) + if [[ $EUID != 0 ]]; then + echo -e "error: Exiting \nTry: 'sudo armbian-config'\n or: 'armbian-config --help' for More info\n\n" + exit 0 + fi + ;; +esac + + +# +# Generate the top menu with the modified Object data +set_colors 4 +generate_top_menu "$json_data" + +# +# Exit the script with a success status code + +# +# Show about this tool on exit +about_armbian_configng + +exit 0 + From 4763901d658c8a5241a42815e3b3429c6955881d Mon Sep 17 00:00:00 2001 From: Tearran Date: Sat, 1 Feb 2025 20:32:33 +0000 Subject: [PATCH 04/18] fix style --- .../modules/initialize/message_checkpoint.sh | 98 +++++++++---------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/tools/modules/initialize/message_checkpoint.sh b/tools/modules/initialize/message_checkpoint.sh index 2e0e50c7f..a0f691729 100644 --- a/tools/modules/initialize/message_checkpoint.sh +++ b/tools/modules/initialize/message_checkpoint.sh @@ -14,54 +14,54 @@ module_options+=( # # Function to manage timer with multiple checkpoints function set_checkpoint() { - case "$1" in - help) - echo "Usage: set_checkpoint [description] [show]" - echo "Commands:" - echo " start Start the timer." - echo " stop Stop the timer." - echo " mark [description] [time] Mark a checkpoint with an optional description and an optional flag to show the output." - echo " show Show the total elapsed time and checkpoints." - ;; - start) - set_checkpoint_START=$(date +%s) - set_checkpoint_CHECKPOINTS=() - set_checkpoint_DESCRIPTIONS=() - set_checkpoint_PREV=$set_checkpoint_START - ;; - stop) - set_checkpoint_STOP=$(date +%s) - ;; - mark) - local checkpoint_time=$(date +%s) - local checkpoint_duration=$((checkpoint_time - set_checkpoint_PREV)) - set_checkpoint_PREV=$checkpoint_time - set_checkpoint_CHECKPOINTS+=($checkpoint_time) - set_checkpoint_DESCRIPTIONS+=("$2") - local count=${#set_checkpoint_DESCRIPTIONS[@]} - if [[ "$3" == "true" && $UXMODE == "true" ]]; then - printf "%-30s %10d seconds\n" "$2:" "${checkpoint_duration}" - fi - ;; - show) - if [[ -n "$set_checkpoint_START" && -n "$set_checkpoint_STOP" ]]; then - set_checkpoint_DURATION=$((set_checkpoint_STOP - set_checkpoint_START)) - printf "%-30s: %d seconds\n" "Total elapsed time" "${set_checkpoint_DURATION}" + case "$1" in + help) + echo "Usage: set_checkpoint [description] [show]" + echo "Commands:" + echo " start Start the timer." + echo " stop Stop the timer." + echo " mark [description] [time] Mark a checkpoint with an optional description and an optional flag to show the output." + echo " show Show the total elapsed time and checkpoints." + ;; + start) + set_checkpoint_START=$(date +%s) + set_checkpoint_CHECKPOINTS=() + set_checkpoint_DESCRIPTIONS=() + set_checkpoint_PREV=$set_checkpoint_START + ;; + stop) + set_checkpoint_STOP=$(date +%s) + ;; + mark) + local checkpoint_time=$(date +%s) + local checkpoint_duration=$((checkpoint_time - set_checkpoint_PREV)) + set_checkpoint_PREV=$checkpoint_time + set_checkpoint_CHECKPOINTS+=($checkpoint_time) + set_checkpoint_DESCRIPTIONS+=("$2") + local count=${#set_checkpoint_DESCRIPTIONS[@]} + if [[ "$3" == "true" && $UXMODE == "true" ]]; then + printf "%-30s %10d seconds\n" "$2:" "${checkpoint_duration}" + fi + ;; + show) + if [[ -n "$set_checkpoint_START" && -n "$set_checkpoint_STOP" ]]; then + set_checkpoint_DURATION=$((set_checkpoint_STOP - set_checkpoint_START)) + printf "%-30s: %d seconds\n" "Total elapsed time" "${set_checkpoint_DURATION}" - local previous_time=$set_checkpoint_START - for i in "${!set_checkpoint_CHECKPOINTS[@]}"; do - local checkpoint_time=${set_checkpoint_CHECKPOINTS[$i]} - local checkpoint_duration=$((checkpoint_time - previous_time)) - local description=${set_checkpoint_DESCRIPTIONS[$i]} - printf "%-30s: %d seconds\n" "${description:-Checkpoint $((i+1))}" "${checkpoint_duration}" - previous_time=$checkpoint_time - done - else - echo "Timer has not been started and stopped properly." - fi - ;; - *) - echo "Usage: set_checkpoint [description]" - ;; - esac + local previous_time=$set_checkpoint_START + for i in "${!set_checkpoint_CHECKPOINTS[@]}"; do + local checkpoint_time=${set_checkpoint_CHECKPOINTS[$i]} + local checkpoint_duration=$((checkpoint_time - previous_time)) + local description=${set_checkpoint_DESCRIPTIONS[$i]} + printf "%-30s: %d seconds\n" "${description:-Checkpoint $((i+1))}" "${checkpoint_duration}" + previous_time=$checkpoint_time + done + else + echo "Timer has not been started and stopped properly." + fi + ;; + *) + echo "Usage: set_checkpoint [description]" + ;; + esac } From c73aba98a983368bfbdaf47f7c688078c4d6ffd2 Mon Sep 17 00:00:00 2001 From: Joey Turner Date: Tue, 4 Feb 2025 22:40:00 -0700 Subject: [PATCH 05/18] Delete tools/armbian-config-dev remove redundant file --- tools/armbian-config-dev | 187 --------------------------------------- 1 file changed, 187 deletions(-) delete mode 100755 tools/armbian-config-dev diff --git a/tools/armbian-config-dev b/tools/armbian-config-dev deleted file mode 100755 index 82d7ddea5..000000000 --- a/tools/armbian-config-dev +++ /dev/null @@ -1,187 +0,0 @@ -#!/bin/bash - -# initializes the terminal from TERM if stdin is a terminal -[[ -t 0 ]] && tput init - -# allows CTRL c to exit -trap "exit" INT TERM -[[ $EUID != 0 ]] && exec sudo "$0" "$@" -# -# Get the script directory -script_dir="$(dirname "$0")" - -declare -A module_options - -# Conditional settings based on arguments -# for interactive vs non-interactive modes -if [[ "$1" == "--api" || "$1" == "--doc" ]]; then - UXMODE="false" -elif [[ -z "$1" || "$1" == "--cmd" || "$1" == "--help" ]]; then - UXMODE="true" -fi - -# Additional check for interactive vs non-interactive mode -if [[ ! -t 0 ]]; then - UXMODE="false" -fi - -# Load the initialize modules -source "$script_dir/../lib/armbian-config/config.initialize.sh" - -set_checkpoint start -set_checkpoint mark "Initializing script" true - -[[ -d "$script_dir/../tools" ]] && tools_dir="$script_dir/../tools" -[[ ! -d "$script_dir/../lib" && -n "$tools_dir" ]] && echo -e "Please run\nbash "$tools_dir/config-assemble.sh" to build the lib directory\n" && exit 1 - -# 'whiptail' is a simple dialog box utility that works well with Bash. It doesn't have all the features of some other dialog box utilities, but it does everything we need for this script. -[[ -x "$(command -v whiptail)" ]] && DIALOG="whiptail" - -# Define the lib directory one level up from the script directory -lib_dir="$script_dir/../lib/armbian-config" -doc_dir="$script_dir/../share/doc/armbian-config" -json_file="$lib_dir/config.jobs.json" - -# -# Load The Bash procedure Objects -json_data=$(<"$json_file") - - -# Load configng core functions and module options array - -source "$lib_dir/config.functions.sh" -set_runtime_variables -set_checkpoint mark "Loaded Runtime variables..." true -# checks for supported os -set_checkpoint mark "$(check_distro_status)" true - -set_checkpoint mark "Loaded Dialog..." true -source "$lib_dir/config.docs.sh" -set_checkpoint mark "Loaded Docs..." true -source "$lib_dir/config.system.sh" -set_checkpoint mark "Loaded System helpers..." true -source "$lib_dir/config.network.sh" -set_checkpoint mark "Loaded Network helpers..." true -source "$lib_dir/config.software.sh" -set_checkpoint mark "Loaded Software helpers..." true -# -# Loads the variables from beta armbian-config for runtime handling - -source "$lib_dir/config.runtime.sh" -echo "Loaded Runtime conditions..." true - -clear - -case "$1" in -"--help") - if [[ -n "$2" ]]; then - see_cmd_list "$2" - echo "" - exit 0 - fi - - echo "Usage: armbian-config --[option] - Options: - --help [category] Use [category] to filter specific menu options. - --cmd [option] Run a command from the menu (simple) - --api [option] Run a helper command (advanced) - --doc Generate the README.md file - - Examples: - armbian-config --help [cmd||System||Software||Network||Localisation] - armbian-config --cmd help - armbian-config --api help -" - exit 0 - ;; -"--doc") - generate_readme - exit 0 - ;; -"--cmd") - shift - if [[ -z "$1" || "$1" == "help" ]]; then - see_cmd_list - exit 0 - fi - - args=$(sanitize_input "$@") - execute_command "$args" - exit 0 - ;; -"--api") - shift - if [[ -z "$1" || "$1" == "help" ]]; then - see_use - exit 0 - fi - option="$1" - shift - - # echo -e "\"$option\" \"$args\"" - "$option" "$@" - exit 0 - ;; -"main=help" | "main=Help") - see_cli_legacy - echo "" - exit 0 - ;; -"main="*) - declare -A main_map - main_map=( - # map name to menu category - ["System"]="S" - ["Software"]="I" - ["Network"]="N" - ["Localisation"]="L" - ) - main_value="${1#main=}" - main_value="${main_map[$main_value]}" - - if [ -z "$main_value" ]; then - echo "Error: Invalid List $1" - exit 1 - fi - declare -A select_map - # map name to menu number - select_map=( - ["Headers"]="04" - ["Headers_install"]="04" - ["Headers_remove"]="05" - ["Firmware"]="06" - ["Nightly"]="07" - ) - select_value="${2#selection=}" - select_value="${select_map[$select_value]}" - if [ -z "$select_value" ]; then - echo "Error: Invalid Option $2" - exit 1 - fi - echo "$main_value""$select_value" - execute_command "$main_value""$select_value" - exit 0 - ;; -*) - if [[ $EUID != 0 ]]; then - echo -e "error: Exiting \nTry: 'sudo armbian-config'\n or: 'armbian-config --help' for More info\n\n" - exit 0 - fi - ;; -esac - - -# -# Generate the top menu with the modified Object data -set_colors 4 -generate_top_menu "$json_data" - -# -# Exit the script with a success status code - -# -# Show about this tool on exit -about_armbian_configng - -exit 0 - From 332536770d39f179e2d340c07eb1fccf80f3d995 Mon Sep 17 00:00:00 2001 From: Joey Turner Date: Wed, 5 Feb 2025 06:08:09 +0000 Subject: [PATCH 06/18] fix conflict --- bin/armbian-config | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/bin/armbian-config b/bin/armbian-config index 82d7ddea5..e884e1e21 100755 --- a/bin/armbian-config +++ b/bin/armbian-config @@ -162,26 +162,23 @@ case "$1" in execute_command "$main_value""$select_value" exit 0 ;; -*) - if [[ $EUID != 0 ]]; then - echo -e "error: Exiting \nTry: 'sudo armbian-config'\n or: 'armbian-config --help' for More info\n\n" - exit 0 - fi + *) + # + # Generate the top menu with the modified Object data + set_colors 4 + generate_top_menu "$json_data" + + # + # Exit the script with a success status code + + # + # Show about this tool on exit + about_armbian_configng ;; esac -# -# Generate the top menu with the modified Object data -set_colors 4 -generate_top_menu "$json_data" - -# -# Exit the script with a success status code -# -# Show about this tool on exit -about_armbian_configng exit 0 From 3cc05d015b9f73ff61569b04cfcbf310747ff949 Mon Sep 17 00:00:00 2001 From: Joey Turner Date: Wed, 5 Feb 2025 06:10:21 +0000 Subject: [PATCH 07/18] part fix conflict --- bin/armbian-config | 171 +++++++++++++++++++++------------------------ 1 file changed, 78 insertions(+), 93 deletions(-) diff --git a/bin/armbian-config b/bin/armbian-config index e884e1e21..80339d8cb 100755 --- a/bin/armbian-config +++ b/bin/armbian-config @@ -73,14 +73,12 @@ echo "Loaded Runtime conditions..." true clear case "$1" in -"--help") - if [[ -n "$2" ]]; then - see_cmd_list "$2" - echo "" - exit 0 - fi - - echo "Usage: armbian-config --[option] + "--help") + if [[ -n "$2" ]]; then + see_cmd_list "$2" + echo "" + else + echo "Usage: armbian-config --[option] Options: --help [category] Use [category] to filter specific menu options. --cmd [option] Run a command from the menu (simple) @@ -92,93 +90,80 @@ case "$1" in armbian-config --cmd help armbian-config --api help " - exit 0 + fi + ;; + + "--doc") + generate_readme + ;; + + "--cmd") + INPUTMODE="cmd" + case "$2" in + ""|"help") + see_cmd_list + ;; + *) + cmd=$(sanitize "$2") || die + execute_command "$cmd" + ;; + esac + ;; + + "--api") + case "$2" in + ""|"help") + see_use + ;; + *) + fn=$(sanitize "$2") || die + shift 2 + "$fn" "$@" + ;; + esac ;; -"--doc") - generate_readme - exit 0 - ;; -"--cmd") - shift - if [[ -z "$1" || "$1" == "help" ]]; then - see_cmd_list - exit 0 - fi - - args=$(sanitize_input "$@") - execute_command "$args" - exit 0 - ;; -"--api") - shift - if [[ -z "$1" || "$1" == "help" ]]; then - see_use - exit 0 - fi - option="$1" - shift - - # echo -e "\"$option\" \"$args\"" - "$option" "$@" - exit 0 - ;; -"main=help" | "main=Help") - see_cli_legacy - echo "" - exit 0 - ;; -"main="*) - declare -A main_map - main_map=( - # map name to menu category - ["System"]="S" - ["Software"]="I" - ["Network"]="N" - ["Localisation"]="L" - ) - main_value="${1#main=}" - main_value="${main_map[$main_value]}" - - if [ -z "$main_value" ]; then - echo "Error: Invalid List $1" - exit 1 - fi - declare -A select_map - # map name to menu number - select_map=( - ["Headers"]="04" - ["Headers_install"]="04" - ["Headers_remove"]="05" - ["Firmware"]="06" - ["Nightly"]="07" - ) - select_value="${2#selection=}" - select_value="${select_map[$select_value]}" - if [ -z "$select_value" ]; then - echo "Error: Invalid Option $2" - exit 1 - fi - echo "$main_value""$select_value" - execute_command "$main_value""$select_value" - exit 0 - ;; - *) - # - # Generate the top menu with the modified Object data - set_colors 4 - generate_top_menu "$json_data" - - # - # Exit the script with a success status code - - # - # Show about this tool on exit - about_armbian_configng - ;; -esac - + "main=help" | "main=Help") + see_cli_legacy + echo "" + ;; + "main="*) + declare -A main_map + main_map=( + # map name to menu category + ["System"]="S" + ["Software"]="I" + ["Network"]="N" + ["Localisation"]="L" + ) + main_value="${1#main=}" + main_value="${main_map[$main_value]}" + [ -z "$main_value" ] && die "Error: Invalid List $1" + + declare -A select_map + # map name to menu number + select_map=( + ["Headers"]="04" + ["Headers_install"]="04" + ["Headers_remove"]="05" + ["Firmware"]="06" + ["Nightly"]="07" + ) + select_value="${2#selection=}" + select_value="${select_map[$select_value]}" + [ -z "$select_value" ] && die "Error: Invalid Option $2" + + echo "$main_value""$select_value" + execute_command "$main_value""$select_value" + ;; -exit 0 + *) + # Generate the top menu with the modified Object data + set_colors 4 + generate_top_menu "$json_data" + # Show about this tool on exit + about_armbian_configng + ;; +esac From 9ed2c23093b314985723347e38c0f368ddcaa7c3 Mon Sep 17 00:00:00 2001 From: Tearran Date: Thu, 6 Feb 2025 06:18:05 +0000 Subject: [PATCH 08/18] update --- bin/armbian-config | 51 +++++++------- tools/armbian-config-dev | 1 + tools/development/dev_message.sh | 18 +++++ .../modules/initialize/message_checkpoint.sh | 70 +++++++++---------- 4 files changed, 80 insertions(+), 60 deletions(-) create mode 120000 tools/armbian-config-dev create mode 100644 tools/development/dev_message.sh diff --git a/bin/armbian-config b/bin/armbian-config index 20ec1b157..ebcbed868 100755 --- a/bin/armbian-config +++ b/bin/armbian-config @@ -1,10 +1,11 @@ #!/bin/bash # initializes the terminal from TERM if stdin is a terminal -[[ -t 0 ]] && tput init - +unset UXMODE +[[ -t 0 && "$1" =~ ^(|--cmd|--help)$ ]] && UXMODE="true" && tput init # allows CTRL c to exit trap "exit" INT TERM + [[ $EUID != 0 ]] && exec sudo "$0" "$@" # # Get the script directory @@ -12,28 +13,27 @@ script_dir="$(dirname "$0")" declare -A module_options -# Conditional settings based on arguments -# for interactive vs non-interactive modes -if [[ "$1" == "--api" || "$1" == "--doc" ]]; then - UXMODE="false" -elif [[ -z "$1" || "$1" == "--cmd" || "$1" == "--help" ]]; then - UXMODE="true" -fi - -# Additional check for interactive vs non-interactive mode -if [[ ! -t 0 ]]; then - UXMODE="false" -fi - # Load the initialize modules source "$script_dir/../lib/armbian-config/config.initialize.sh" +# Start loading messages set_checkpoint start -set_checkpoint mark "Initializing script" true +set_checkpoint mark "Initializing script" [[ -d "$script_dir/../tools" ]] && tools_dir="$script_dir/../tools" [[ ! -d "$script_dir/../lib" && -n "$tools_dir" ]] && die -e "Please run\nbash "$tools_dir/config-assemble.sh" to build the lib directory\n" + +DEV=$([[ "$(basename "$0")" =~ .*"-dev"$ ]] && echo "true") + +# If the script name ends with "-dev", source all .sh files in the dev directory +if [[ "$DEV" == "true" ]]; then + for file in "$tools_dir/development"/*.sh; do + set_checkpoint mark "Loading development modules" + . "$file" + done +fi + # 'whiptail' is a simple dialog box utility that works well with Bash. It doesn't have all the features of some other dialog box utilities, but it does everything we need for this script. [[ -x "$(command -v whiptail)" ]] && DIALOG="whiptail" @@ -51,24 +51,25 @@ json_data=$(<"$json_file") source "$lib_dir/config.functions.sh" set_runtime_variables -set_checkpoint mark "Loaded Runtime variables..." true +set_checkpoint mark "Loaded Runtime variables..." # checks for supported os -set_checkpoint mark "$(check_distro_status)" true +set_checkpoint mark "$(check_distro_status)" -set_checkpoint mark "Loaded Dialog..." true +set_checkpoint mark "Loaded Dialog..." source "$lib_dir/config.docs.sh" -set_checkpoint mark "Loaded Docs..." true +set_checkpoint mark "Loaded Docs..." source "$lib_dir/config.system.sh" -set_checkpoint mark "Loaded System helpers..." true +set_checkpoint mark "Loaded System helpers..." source "$lib_dir/config.network.sh" -set_checkpoint mark "Loaded Network helpers..." true +set_checkpoint mark "Loaded Network helpers..." source "$lib_dir/config.software.sh" -set_checkpoint mark "Loaded Software helpers..." true +set_checkpoint mark "Loaded Software helpers..." # # Loads the variables from beta armbian-config for runtime handling source "$lib_dir/config.runtime.sh" -echo "Loaded Runtime conditions..." true +set_checkpoint mark "Loaded Runtime conditions..." +set_checkpoint stop case "$1" in "--help") @@ -77,7 +78,7 @@ case "$1" in echo "" else echo "Usage: armbian-config --[option] - Options: + Options: --help [category] Use [category] to filter specific menu options. --cmd [option] Run a command from the menu (simple) --api [option] Run a helper command (advanced) diff --git a/tools/armbian-config-dev b/tools/armbian-config-dev new file mode 120000 index 000000000..386782a6b --- /dev/null +++ b/tools/armbian-config-dev @@ -0,0 +1 @@ +../bin/armbian-config \ No newline at end of file diff --git a/tools/development/dev_message.sh b/tools/development/dev_message.sh new file mode 100644 index 000000000..92a1565f4 --- /dev/null +++ b/tools/development/dev_message.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# +dev_playground() { + # playground + set_checkpoint mark "Loading Production modules in [##########]" + sleep 0.25 + set_checkpoint mark "Loading Production modules in [####### ]" + sleep 0.25 + set_checkpoint mark "Loading Production modules in [##### ]" + sleep 0.25 + set_checkpoint mark "Loading Production modules in [## ]" + sleep 0.25 + echo "Loading Production modules " + +} + +dev_playground diff --git a/tools/modules/initialize/message_checkpoint.sh b/tools/modules/initialize/message_checkpoint.sh index a0f691729..adea909df 100644 --- a/tools/modules/initialize/message_checkpoint.sh +++ b/tools/modules/initialize/message_checkpoint.sh @@ -16,52 +16,52 @@ module_options+=( function set_checkpoint() { case "$1" in help) - echo "Usage: set_checkpoint [description] [show]" - echo "Commands:" - echo " start Start the timer." - echo " stop Stop the timer." - echo " mark [description] [time] Mark a checkpoint with an optional description and an optional flag to show the output." - echo " show Show the total elapsed time and checkpoints." + echo "Usage: set_checkpoint [description] [show]" + echo "Commands:" + echo " start Start the timer." + echo " stop Stop the timer." + echo " mark [description] [time] Mark a checkpoint with an optional description and an optional flag to show the output." + echo " show Show the total elapsed time and checkpoints." ;; start) - set_checkpoint_START=$(date +%s) - set_checkpoint_CHECKPOINTS=() - set_checkpoint_DESCRIPTIONS=() - set_checkpoint_PREV=$set_checkpoint_START + set_checkpoint_START=$(date +%s) + set_checkpoint_CHECKPOINTS=() + set_checkpoint_DESCRIPTIONS=() + set_checkpoint_PREV=$set_checkpoint_START ;; stop) - set_checkpoint_STOP=$(date +%s) + set_checkpoint_STOP=$(date +%s) ;; mark) - local checkpoint_time=$(date +%s) - local checkpoint_duration=$((checkpoint_time - set_checkpoint_PREV)) - set_checkpoint_PREV=$checkpoint_time - set_checkpoint_CHECKPOINTS+=($checkpoint_time) - set_checkpoint_DESCRIPTIONS+=("$2") - local count=${#set_checkpoint_DESCRIPTIONS[@]} - if [[ "$3" == "true" && $UXMODE == "true" ]]; then - printf "%-30s %10d seconds\n" "$2:" "${checkpoint_duration}" - fi + if [[ "$UXMODE" == "true" ]]; then + local checkpoint_time=$(date +%s) + local checkpoint_duration=$((checkpoint_time - set_checkpoint_PREV)) + set_checkpoint_PREV=$checkpoint_time + set_checkpoint_CHECKPOINTS+=($checkpoint_time) + set_checkpoint_DESCRIPTIONS+=("$2") + local count=${#set_checkpoint_DESCRIPTIONS[@]} + printf "%-30s %10d seconds\n" "$2 " "${checkpoint_duration}" + fi ;; show) - if [[ -n "$set_checkpoint_START" && -n "$set_checkpoint_STOP" ]]; then - set_checkpoint_DURATION=$((set_checkpoint_STOP - set_checkpoint_START)) - printf "%-30s: %d seconds\n" "Total elapsed time" "${set_checkpoint_DURATION}" + if [[ -n "$set_checkpoint_START" && -n "$set_checkpoint_STOP" ]]; then + set_checkpoint_DURATION=$((set_checkpoint_STOP - set_checkpoint_START)) + printf "%-30s: %d seconds\n" "Total elapsed time" "${set_checkpoint_DURATION}" - local previous_time=$set_checkpoint_START - for i in "${!set_checkpoint_CHECKPOINTS[@]}"; do - local checkpoint_time=${set_checkpoint_CHECKPOINTS[$i]} - local checkpoint_duration=$((checkpoint_time - previous_time)) - local description=${set_checkpoint_DESCRIPTIONS[$i]} - printf "%-30s: %d seconds\n" "${description:-Checkpoint $((i+1))}" "${checkpoint_duration}" - previous_time=$checkpoint_time - done - else - echo "Timer has not been started and stopped properly." - fi + local previous_time=$set_checkpoint_START + for i in "${!set_checkpoint_CHECKPOINTS[@]}"; do + local checkpoint_time=${set_checkpoint_CHECKPOINTS[$i]} + local checkpoint_duration=$((checkpoint_time - previous_time)) + local description=${set_checkpoint_DESCRIPTIONS[$i]} + printf "%-30s: %d seconds\n" "${description:-Checkpoint $((i+1))}" "${checkpoint_duration}" + previous_time=$checkpoint_time + done + else + echo "Timer has not been started and stopped properly." + fi ;; *) - echo "Usage: set_checkpoint [description]" + echo "Usage: set_checkpoint [description]" ;; esac } From 41d77c91e1e1b9261830148ee3852c03ee0bc02b Mon Sep 17 00:00:00 2001 From: Tearran Date: Fri, 7 Feb 2025 08:41:35 +0000 Subject: [PATCH 09/18] rfine set_checkpoint show to use for debug --- bin/armbian-config | 19 ++++++------------- tools/armbian-config-dev | 1 - .../modules/initialize/message_checkpoint.sh | 5 +++-- 3 files changed, 9 insertions(+), 16 deletions(-) delete mode 120000 tools/armbian-config-dev diff --git a/bin/armbian-config b/bin/armbian-config index ebcbed868..4c71c2c2c 100755 --- a/bin/armbian-config +++ b/bin/armbian-config @@ -23,17 +23,6 @@ set_checkpoint mark "Initializing script" [[ -d "$script_dir/../tools" ]] && tools_dir="$script_dir/../tools" [[ ! -d "$script_dir/../lib" && -n "$tools_dir" ]] && die -e "Please run\nbash "$tools_dir/config-assemble.sh" to build the lib directory\n" - -DEV=$([[ "$(basename "$0")" =~ .*"-dev"$ ]] && echo "true") - -# If the script name ends with "-dev", source all .sh files in the dev directory -if [[ "$DEV" == "true" ]]; then - for file in "$tools_dir/development"/*.sh; do - set_checkpoint mark "Loading development modules" - . "$file" - done -fi - # 'whiptail' is a simple dialog box utility that works well with Bash. It doesn't have all the features of some other dialog box utilities, but it does everything we need for this script. [[ -x "$(command -v whiptail)" ]] && DIALOG="whiptail" @@ -69,7 +58,10 @@ set_checkpoint mark "Loaded Software helpers..." source "$lib_dir/config.runtime.sh" set_checkpoint mark "Loaded Runtime conditions..." -set_checkpoint stop + +# usage: sudo DEBUG=1 ./config-time/bin/armbian-config $@ +# place one in a section with a quoted "about message" +[[ -n "$DEBUG" ]] && set_checkpoint mark "DEBUG Meaasges on" ; case "$1" in "--help") @@ -161,8 +153,9 @@ case "$1" in # Generate the top menu with the modified Object data set_colors 4 generate_top_menu "$json_data" - # Show about this tool on exit about_armbian_configng ;; esac + +[[ -n "$DEBUG" && -n $tools_dir ]] && set_checkpoint show \ No newline at end of file diff --git a/tools/armbian-config-dev b/tools/armbian-config-dev deleted file mode 120000 index 386782a6b..000000000 --- a/tools/armbian-config-dev +++ /dev/null @@ -1 +0,0 @@ -../bin/armbian-config \ No newline at end of file diff --git a/tools/modules/initialize/message_checkpoint.sh b/tools/modules/initialize/message_checkpoint.sh index adea909df..4b1cae386 100644 --- a/tools/modules/initialize/message_checkpoint.sh +++ b/tools/modules/initialize/message_checkpoint.sh @@ -33,17 +33,18 @@ function set_checkpoint() { set_checkpoint_STOP=$(date +%s) ;; mark) - if [[ "$UXMODE" == "true" ]]; then + if [[ "$UXMODE" == "true" || -n "$DEBUG" ]]; then local checkpoint_time=$(date +%s) local checkpoint_duration=$((checkpoint_time - set_checkpoint_PREV)) set_checkpoint_PREV=$checkpoint_time set_checkpoint_CHECKPOINTS+=($checkpoint_time) set_checkpoint_DESCRIPTIONS+=("$2") local count=${#set_checkpoint_DESCRIPTIONS[@]} - printf "%-30s %10d seconds\n" "$2 " "${checkpoint_duration}" + [[ -z "$DEBUG" ]] && printf "%-30s %10d seconds\n" "$2 " "${checkpoint_duration}" fi ;; show) + [[ -z "$set_checkpoint_STOP" ]] && set_checkpoint stop if [[ -n "$set_checkpoint_START" && -n "$set_checkpoint_STOP" ]]; then set_checkpoint_DURATION=$((set_checkpoint_STOP - set_checkpoint_START)) printf "%-30s: %d seconds\n" "Total elapsed time" "${set_checkpoint_DURATION}" From c18a50eb154b4fcb93af24bb4aa2eca09bf20b57 Mon Sep 17 00:00:00 2001 From: Tearran Date: Fri, 7 Feb 2025 09:07:26 +0000 Subject: [PATCH 10/18] rm consept --- tools/development/dev_message.sh | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 tools/development/dev_message.sh diff --git a/tools/development/dev_message.sh b/tools/development/dev_message.sh deleted file mode 100644 index 92a1565f4..000000000 --- a/tools/development/dev_message.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# -dev_playground() { - # playground - set_checkpoint mark "Loading Production modules in [##########]" - sleep 0.25 - set_checkpoint mark "Loading Production modules in [####### ]" - sleep 0.25 - set_checkpoint mark "Loading Production modules in [##### ]" - sleep 0.25 - set_checkpoint mark "Loading Production modules in [## ]" - sleep 0.25 - echo "Loading Production modules " - -} - -dev_playground From e43bb8ec7dd34b0d5ddfee1e52cee096f3fd252b Mon Sep 17 00:00:00 2001 From: Tearran Date: Sat, 8 Feb 2025 04:57:55 +0000 Subject: [PATCH 11/18] fix typo --- bin/armbian-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/armbian-config b/bin/armbian-config index 4c71c2c2c..94088780f 100755 --- a/bin/armbian-config +++ b/bin/armbian-config @@ -61,7 +61,7 @@ set_checkpoint mark "Loaded Runtime conditions..." # usage: sudo DEBUG=1 ./config-time/bin/armbian-config $@ # place one in a section with a quoted "about message" -[[ -n "$DEBUG" ]] && set_checkpoint mark "DEBUG Meaasges on" ; +[[ -n "$DEBUG" ]] && set_checkpoint mark "DEBUG Messages on" ; case "$1" in "--help") From c51a575b193b8138f4e8c9ee4fd990ab7d8fdc3e Mon Sep 17 00:00:00 2001 From: Tearran Date: Sat, 8 Feb 2025 06:59:01 +0000 Subject: [PATCH 12/18] Added alias/helper `checkpoint` with a debug option. --- bin/armbian-config | 3 ++ .../modules/initialize/message_checkpoint.sh | 38 ++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/bin/armbian-config b/bin/armbian-config index 94088780f..5747479fe 100755 --- a/bin/armbian-config +++ b/bin/armbian-config @@ -102,14 +102,17 @@ case "$1" in ;; "--api") + checkpoint debug "Starting --api options" case "$2" in ""|"help") see_use + checkpoint debug "Exiting help message" ;; *) fn=$(sanitize "$2") || die shift 2 "$fn" "$@" + checkpoint debug "Exiting --api" ;; esac ;; diff --git a/tools/modules/initialize/message_checkpoint.sh b/tools/modules/initialize/message_checkpoint.sh index 4b1cae386..9fd76ed0e 100644 --- a/tools/modules/initialize/message_checkpoint.sh +++ b/tools/modules/initialize/message_checkpoint.sh @@ -1,4 +1,3 @@ - module_options+=( ["set_checkpoint,author"]="@armbian" ["set_checkpoint,maintainer"]="@igorpecovnik" @@ -11,6 +10,19 @@ module_options+=( ["set_checkpoint,port"]="" ["set_checkpoint,arch"]="x86-64 arm64" ) + +module_options+=( + ["debug_checkpoint,author"]="@armbian" + ["debug_checkpoint,maintainer"]="@igorpecovnik" + ["debug_checkpoint,feature"]="debug_checkpoint" + ["debug_checkpoint,example"]="help start mark stop show" + ["debug_checkpoint,desc"]="Helper module for debug info" + ["debug_checkpoint,status"]="" + ["debug_checkpoint,doc_link"]="" + ["debug_checkpoint,group"]="Development" + ["debug_checkpoint,port"]="" + ["debug_checkpoint,arch"]="x86-64 arm64" +) # # Function to manage timer with multiple checkpoints function set_checkpoint() { @@ -40,7 +52,11 @@ function set_checkpoint() { set_checkpoint_CHECKPOINTS+=($checkpoint_time) set_checkpoint_DESCRIPTIONS+=("$2") local count=${#set_checkpoint_DESCRIPTIONS[@]} + # No debug UX mode debug level 1 defaulted here [[ -z "$DEBUG" ]] && printf "%-30s %10d seconds\n" "$2 " "${checkpoint_duration}" + + # debug level 2 shows all message + [[ "$DEBUG" -eq 2 ]] && printf "%-30s %10d seconds\n" "$2 " "${checkpoint_duration}" fi ;; show) @@ -66,3 +82,23 @@ function set_checkpoint() { ;; esac } + +# Example usage +# set_checkpoint aluse with debugging +checkpoint() { + case "$1" in + start|stop|mark|show) + set_checkpoint "$1" "$2" + ;; + debug) + [[ -n "$DEBUG" && -n $tools_dir ]] && set_checkpoint mark "$2" + ;; + help) + set_checkpoint help + echo " debug DEBUG checkpoint message" + ;; + *) + echo "Invalid command. Use: help, start, stop, mark, debug, show" + ;; + esac +} From 49622a7b099e08da38d0fd745fb011a5070409a7 Mon Sep 17 00:00:00 2001 From: Tearran Date: Sat, 8 Feb 2025 07:12:07 +0000 Subject: [PATCH 13/18] added checkpoint to --api --cmd --- bin/armbian-config | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/armbian-config b/bin/armbian-config index 5747479fe..bff03af74 100755 --- a/bin/armbian-config +++ b/bin/armbian-config @@ -89,14 +89,17 @@ case "$1" in ;; "--cmd") + checkpoint debug "Starting Command line UX option" INPUTMODE="cmd" case "$2" in ""|"help") see_cmd_list + checkpoint debug "Exiting help message" ;; *) cmd=$(sanitize "$2") || die execute_command "$cmd" + checkpoint debug "Starting Command line options UX" ;; esac ;; @@ -155,9 +158,12 @@ case "$1" in *) # Generate the top menu with the modified Object data set_colors 4 + checkpoint debug "Starting Text User Interface (TUI)" generate_top_menu "$json_data" - # Show about this tool on exit + checkpoint debug "Exiting TUI" + # Show about this tool on exit about_armbian_configng + ;; esac From f34bb9610360f6308af7ef17f93c03f634bfbe18 Mon Sep 17 00:00:00 2001 From: Tearran Date: Sat, 8 Feb 2025 07:41:47 +0000 Subject: [PATCH 14/18] fix style --- bin/armbian-config | 2 -- .../modules/initialize/message_checkpoint.sh | 30 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/bin/armbian-config b/bin/armbian-config index bff03af74..1d6dbed66 100755 --- a/bin/armbian-config +++ b/bin/armbian-config @@ -94,7 +94,6 @@ case "$1" in case "$2" in ""|"help") see_cmd_list - checkpoint debug "Exiting help message" ;; *) cmd=$(sanitize "$2") || die @@ -109,7 +108,6 @@ case "$1" in case "$2" in ""|"help") see_use - checkpoint debug "Exiting help message" ;; *) fn=$(sanitize "$2") || die diff --git a/tools/modules/initialize/message_checkpoint.sh b/tools/modules/initialize/message_checkpoint.sh index 9fd76ed0e..0e7d65de6 100644 --- a/tools/modules/initialize/message_checkpoint.sh +++ b/tools/modules/initialize/message_checkpoint.sh @@ -86,19 +86,19 @@ function set_checkpoint() { # Example usage # set_checkpoint aluse with debugging checkpoint() { - case "$1" in - start|stop|mark|show) - set_checkpoint "$1" "$2" - ;; - debug) - [[ -n "$DEBUG" && -n $tools_dir ]] && set_checkpoint mark "$2" - ;; - help) - set_checkpoint help - echo " debug DEBUG checkpoint message" - ;; - *) - echo "Invalid command. Use: help, start, stop, mark, debug, show" - ;; - esac + case "$1" in + start|stop|mark|show) + set_checkpoint "$1" "$2" + ;; + debug) + [[ -n "$DEBUG" && -n $tools_dir ]] && set_checkpoint mark "$2" + ;; + help) + set_checkpoint help + echo " debug DEBUG checkpoint message" + ;; + *) + echo "Invalid command. Use: help, start, stop, mark, debug, show" + ;; + esac } From 9b8fbe1d77ea10ddbd958019902e7f51a52fb204 Mon Sep 17 00:00:00 2001 From: Tearran Date: Sat, 8 Feb 2025 08:21:33 +0000 Subject: [PATCH 15/18] explore testcase error --- tests/MAN001.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/MAN001.conf b/tests/MAN001.conf index 578cfd0af..fc6c07223 100644 --- a/tests/MAN001.conf +++ b/tests/MAN001.conf @@ -5,5 +5,5 @@ testcase() {( set -e ./bin/armbian-config --api module_cockpit remove || true ./bin/armbian-config --api module_cockpit install - [[ -f /usr/bin/cockpit-bridge ]] + [[ -f /usr/bin/cockpit-bridge ]] && return 0 )} From d098af4bfcc5bf1e25b7a8abc81563e2e8441964 Mon Sep 17 00:00:00 2001 From: Tearran Date: Sat, 8 Feb 2025 08:23:20 +0000 Subject: [PATCH 16/18] revert test case --- tests/MAN001.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/MAN001.conf b/tests/MAN001.conf index fc6c07223..578cfd0af 100644 --- a/tests/MAN001.conf +++ b/tests/MAN001.conf @@ -5,5 +5,5 @@ testcase() {( set -e ./bin/armbian-config --api module_cockpit remove || true ./bin/armbian-config --api module_cockpit install - [[ -f /usr/bin/cockpit-bridge ]] && return 0 + [[ -f /usr/bin/cockpit-bridge ]] )} From 4d6ab8b0a1cc572e864c9b9abde372d16f1b0525 Mon Sep 17 00:00:00 2001 From: Tearran Date: Sat, 8 Feb 2025 08:34:34 +0000 Subject: [PATCH 17/18] explore 2 --- tests/MAN001.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/MAN001.conf b/tests/MAN001.conf index 578cfd0af..a0c1c5e5d 100644 --- a/tests/MAN001.conf +++ b/tests/MAN001.conf @@ -3,7 +3,8 @@ RELEASE="bookworm:noble" # run on specific or leave empty to run on all testcase() {( set -e - ./bin/armbian-config --api module_cockpit remove || true + ./bin/armbian-config --api module_cockpit remove ./bin/armbian-config --api module_cockpit install - [[ -f /usr/bin/cockpit-bridge ]] + file="${ls /usr/bin/cockpit-bridge)" + [[ -n "$file" ]] )} From c49c4a34bf3e7742d0e8fee016c96e5f3519ce01 Mon Sep 17 00:00:00 2001 From: Joey Turner Date: Sat, 8 Feb 2025 14:28:56 -0700 Subject: [PATCH 18/18] Update MAN001.conf revert module_cockpit test case --- tests/MAN001.conf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/MAN001.conf b/tests/MAN001.conf index a0c1c5e5d..578cfd0af 100644 --- a/tests/MAN001.conf +++ b/tests/MAN001.conf @@ -3,8 +3,7 @@ RELEASE="bookworm:noble" # run on specific or leave empty to run on all testcase() {( set -e - ./bin/armbian-config --api module_cockpit remove + ./bin/armbian-config --api module_cockpit remove || true ./bin/armbian-config --api module_cockpit install - file="${ls /usr/bin/cockpit-bridge)" - [[ -n "$file" ]] + [[ -f /usr/bin/cockpit-bridge ]] )}