armbian-next: introduce assert_prepared_host() and assert before using any Python, to un-mask any further fallacies

This commit is contained in:
Ricardo Pardini
2023-01-29 22:32:49 +01:00
parent 956ef9ac7d
commit 19aa7e95cf
3 changed files with 10 additions and 1 deletions

View File

@@ -10,6 +10,12 @@ function prepare_host() {
return 0
}
function assert_prepared_host() {
if [[ ${prepare_host_has_already_run:-0} -lt 1 ]]; then
exit_with_error "assert_prepared_host: Host has not yet been prepared. This is a bug in armbian-next code. Please report!"
fi
}
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
@@ -185,6 +191,8 @@ function prepare_host_noninteractive() {
# Reset owner of userpatches if so required
reset_uid_owner "${USERPATCHES_PATH}" # Fix owner of files in the final destination
declare -i -g -r prepare_host_has_already_run=1 # global, readonly.
return 0
}