Skip to content

Commit

Permalink
moved sourcing rutime
Browse files Browse the repository at this point in the history
  • Loading branch information
Tearran committed Dec 18, 2024
1 parent b89d82b commit 292a587
Showing 1 changed file with 36 additions and 15 deletions.
51 changes: 36 additions & 15 deletions bin/armbian-config
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trap "exit" INT TERM
script_dir="$(dirname "$0")"

[[ -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
[[ ! -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"
Expand All @@ -36,10 +36,11 @@ declare -A module_options
# Load configng core functions and module options array

source "$lib_dir/config.functions.sh"
# TODO move to runtime file
set_runtime_variables
check_distro_status
echo "Loaded Runtime variables..." #| show_infobox ;
#set_newt_colors 2
# TODO
echo "Loaded Dialog..." #| show_infobox ;
source "$lib_dir/config.docs.sh"
echo "Loaded Docs..." #| show_infobox ;
Expand All @@ -52,8 +53,7 @@ echo "Loaded Software helpers..." #| show_infobox ;
#
# Loads the variables from beta armbian-config for runtime handling

source "$lib_dir/config.runtime.sh"
echo "Loaded Runtime conditions..." #| show_infobox ;


clear

Expand All @@ -70,49 +70,65 @@ case "$1" in
--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
--doc Generate the README.md file
Examples:
armbian-config --help [cmd||System||Software||Network||Localisation]
armbian-config --cmd help
armbian-config --cmd help
armbian-config --api help
"
exit 0
;;
"--doc")
# TODO: move --doc to --api
generate_readme
exit 0
;;
"--cmd")
# TODO move source for related groups
# to respective case switch
# Interface group not sepeated and mixed in functions and docs etc..
# TODO Sort and group interface for source file
INPUTMODE="cmd"
shift
if [[ -z "$1" || "$1" == "help" ]]; then
see_cmd_list
exit 0
fi

args=$(sanitize_input "$@")
args="$@"
execute_command "$args"
exit 0
;;
"--api")
# move source for related groups
# to respective case switch
# source "$lib_dir/config.docs.sh"
# TODO remove interface spacifice function from docs into there own group files.
shift
option="$1"
[[ "$option" == "json" ]] && generate_json_options && exit 0 ;
[[ "$option" == "docs" ]] && generate_readme && exit 0 ;
if [[ -z "$option" || "$option" == "help" ]] ; then
echo "Options:"
echo " json - database in json format"
echo " docs - generate DOCUMEMT.md"
echo ""
exit 0 ;
fi
shift
# stage for seperation
args="$@"
[[ -z "$args" ]] && generate_json_options ;
# echo -e "\"$option\" \"$args\""
"$option" "$args"
exit 0
;;
"--noint")
shift
if [[ -z "$1" || "$1" == "help" ]]; then
see_use
exit 0
fi
option="$1"
[[ "$option" == "help" ]] && see_use ; exit 0 ;
shift
args="$@"
# echo -e "\"$option\" \"$args\""
"$option" "$args"
"$option" "$args" <&-
exit 0
;;
"main=help" | "main=Help")
Expand Down Expand Up @@ -163,6 +179,11 @@ case "$1" in
;;
esac

clear
echo "Almost there ..." #| show_infobox ;
echo "Checking Runtime conditions..." #| show_infobox ;
source "$lib_dir/config.runtime.sh"
echo "Loaded Runtime conditions..." #| show_infobox ;

#
# Generate the top menu with the modified Object data
Expand Down

0 comments on commit 292a587

Please sign in to comment.