armbian-next: do basic host checks before config if interactive, or during prepare-host if not

- group basic checks at `check_basic_host()`
This commit is contained in:
Ricardo Pardini 2023-01-17 01:11:43 +01:00
parent f549ddb273
commit ff94b79e60
No known key found for this signature in database
GPG Key ID: 3D38CA12A66C5D02
2 changed files with 17 additions and 6 deletions

View File

@ -6,17 +6,23 @@
# * changes system settings
#
function prepare_host() {
# Those are not logged, and might be interactive.
display_alert "Checking" "host" "info"
obtain_and_check_host_release_and_arch # sets HOSTRELEASE and validates it for sanity; also HOSTARCH
check_windows_wsl2 # checks if on Windows, on WSL2, (not 1) and exits if not supported
check_host_has_enough_disk_space # Checks disk space and exits if not enough
wait_for_package_manager # wait until dpkg is not locked...
# Now, if NOT interactive, do some basic checks. If interactive, those have already run back in prepare_and_config_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
}
function check_basic_host() {
display_alert "Checking" "basic host setup" "info"
obtain_and_check_host_release_and_arch # sets HOSTRELEASE and validates it for sanity; also HOSTARCH
check_host_has_enough_disk_space # Checks disk space and exits if not enough
check_windows_wsl2 # checks if on Windows, on WSL2, (not 1) and exits if not supported
wait_for_package_manager # wait until dpkg is not locked...
}
function prepare_host_noninteractive() {
display_alert "Preparing" "host" "info"

View File

@ -3,6 +3,11 @@
function prepare_and_config_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
check_basic_host
fi
# those are possibly interactive. interactive (dialog) and logging don't mix, for obvious reasons.
interactive_config_prepare_terminal # init vars used for interactive
config_possibly_interactive_kernel_board