armbian_build/lib/functions/cli/cli-requirements.sh
Ricardo Pardini d4d3c1346c
armbian-oleg: split hostdeps again, full of ifs, and reduce the minimum set of pkgs for Oleg-conditions while trying to keep Docker full
- probably breaks a lot of stuff; c++ compilers, distcc, possibly others
- split into late_prepare_host_dependencies / early_prepare_host_dependencies calling adaptative_prepare_host_dependencies() full of if's

also:
- calc deps out of configuration
- reorg checks into obtain_and_check_host_release_and_arch()
2023-02-18 07:42:11 -03:00

28 lines
1.2 KiB
Bash

function cli_requirements_pre_run() {
declare -g ARMBIAN_COMMAND_REQUIRE_BASIC_DEPS="yes" # Require prepare_host_basic to run before the command.
if [[ "$(uname)" != "Linux" ]]; then
display_alert "Not running on Linux" "refusing to run 'requirements'" "err"
exit 1
fi
if [[ "${EUID}" == "0" ]]; then # we're already root. Either running as real root, or already sudo'ed.
display_alert "Already running as root" "great" "debug"
else
# Fail, installing requirements is not allowed as non-root.
exit_with_error "This command requires root privileges - refusing to run"
fi
}
function cli_requirements_run() {
initialize_extension_manager # initialize the extension manager.
declare -a -g host_dependencies=()
obtain_and_check_host_release_and_arch # Sets HOSTRELEASE & validates it for sanity; also HOSTARCH
host_release="${HOSTRELEASE}" host_arch="${HOSTARCH}" early_prepare_host_dependencies
LOG_SECTION="install_host_dependencies" do_with_logging install_host_dependencies "for requirements command"
LOG_SECTION="prepare_pip_packages_for_python_tools" do_with_logging prepare_pip_packages_for_python_tools
display_alert "Done with" "@host dependencies" "cachehit"
}