armbian-next: interactive: review -t 0 instead of -t 1; move non-interactive check_basic_host() from prepare-host to config-prepare, for consistency

This commit is contained in:
Ricardo Pardini 2023-01-27 22:33:39 +01:00
parent 41d7d0155e
commit fa666aa3d4
No known key found for this signature in database
GPG Key ID: 3D38CA12A66C5D02
3 changed files with 7 additions and 8 deletions

View File

@ -155,8 +155,7 @@ function kernel_prepare_bare_repo_decide_shallow_or_full() {
display_alert "git_kernel_oras_ref" "${git_kernel_oras_ref}" "git"
display_alert "estimated_dl_size_mib" "${estimated_dl_size_mib}" "git"
# if ask_for_user_confirmation -eq 1 and -t 1
if [[ ${ask_for_user_confirmation} -eq 1 && -t 1 ]]; then
if [[ ${ask_for_user_confirmation} -eq 1 && -t 0 ]]; then # -t 0 means stdin is a terminal
echo "--------------------------------------------------------------------------------------------------------------------" >&2
display_alert "Warning: no Kernel bare tree exists for version ${KERNEL_MAJOR_MINOR} - about to start downloading." "" "wrn"
display_alert "Armbian is going to use a '${decision}' git tree, which is around" "${estimated_dl_size_mib}MiB" ""

View File

@ -6,11 +6,6 @@
# * changes system settings
#
function prepare_host() {
# Now, if NOT interactive, do some basic checks. If interactive, those have already run back in prep_conf_main_build_single()
if [[ ! -t 1 ]]; then
LOG_SECTION="ni_check_basic_host" do_with_logging check_basic_host
fi
LOG_SECTION="prepare_host_noninteractive" do_with_logging prepare_host_noninteractive
return 0
}

View File

@ -5,7 +5,7 @@ function prep_conf_main_build_single() {
LOG_SECTION="config_early_init" do_with_conditional_logging config_early_init
# if interactive, call prepare-host.sh::check_basic_host() early, to avoid disappointments later.
if [[ -t 1 ]]; then
if [[ -t 0 ]]; then
check_basic_host
fi
@ -28,6 +28,11 @@ function prep_conf_main_build_single() {
LOG_SECTION="config_post_main" do_with_conditional_logging config_post_main
# Now, if NOT interactive, do some basic checks. If interactive, it has been done 20 lines above.
if [[ ! -t 0 ]]; then
LOG_SECTION="ni_check_basic_host" do_with_logging check_basic_host
fi
aggregate_packages_in_logging_section
display_alert "Configuration prepared for BOARD build" "${BOARD}.${BOARD_TYPE}" "info"