armbian_build/lib/functions/cli/cli-rootfs.sh
Ricardo Pardini 28d89e2c91
armbian-next: rootfs: new CLI command for rootfs cache building; further refactorings
- _told ya it would all make sense eventually..._
- introduce new, real, non-alias `rootfs` command in `cli-rootfs` -- this _only_ builds rootfs, nothing else
- no more `main_default_build_single()`; instead `full_build_packages_rootfs_and_image()`
- introduce `do_with_default_build()` wrapper, for things that need host prepared + aggregation to run
- CLI-specific parts of `main_default_build_single()` moved to cli-build
- put prepare/cleanup pair of `prepare_rootfs_build_params_and_trap()` and `trap_handler_cleanup_rootfs_and_image()` into new `trap-rootfs.sh` (this needs further splitting for the image part)
- refactor `get_or_create_rootfs_cache_chroot_sdcard()` into `build_rootfs_only()`, `calculate_rootfs_cache_id()`
- update library with new files
2023-02-18 07:44:22 -03:00

26 lines
1.1 KiB
Bash

function cli_rootfs_pre_run() {
declare -g ARMBIAN_COMMAND_REQUIRE_BASIC_DEPS="yes" # Require prepare_host_basic to run before the command.
# "gimme root on a Linux machine"
cli_standard_relaunch_docker_or_sudo
}
function cli_rootfs_run() {
# configuration etc - it initializes the extension manager; handles its own logging sections
prep_conf_main_build_single
# default build, but only invoke specific rootfs functions needed. It has its own logging sections.
do_with_default_build cli_rootfs_only_in_default_build
}
# This is run inside do_with_default_build(), above.
function cli_rootfs_only_in_default_build() {
declare -i tmpfs_estimated_size # in MiB; set by prepare_rootfs_build_params_and_trap()
LOG_SECTION="prepare_rootfs_build_params_and_trap" do_with_logging prepare_rootfs_build_params_and_trap
LOG_SECTION="calculate_rootfs_cache_id" do_with_logging calculate_rootfs_cache_id
# "rootfs" CLI skips over a lot goes straight to create the rootfs. It doesn't check cache etc.
LOG_SECTION="create_new_rootfs_cache" do_with_logging create_new_rootfs_cache
}