armbian-next: small cleanups: squash typos / add function keyword / add types / mark dead code
This commit is contained in:
parent
0ea0fe3528
commit
35fbb7ed6c
@ -3,7 +3,7 @@
|
||||
#
|
||||
# finishes creation of image from cached rootfs
|
||||
#
|
||||
create_image_from_sdcard_rootfs() {
|
||||
function create_image_from_sdcard_rootfs() {
|
||||
# create DESTIMG, hooks might put stuff there early.
|
||||
mkdir -p "${DESTIMG}"
|
||||
|
||||
|
||||
@ -118,15 +118,15 @@ function add_cleanup_handler() {
|
||||
function execute_and_remove_cleanup_handler() {
|
||||
local callback="$1"
|
||||
display_alert "Execute and remove cleanup handler" "${callback}" "cleanup"
|
||||
local remaning_cleanups=()
|
||||
local remaining_cleanups=()
|
||||
for one_cleanup_handler in "${trap_manager_cleanup_handlers[@]}"; do
|
||||
if [[ "${one_cleanup_handler}" != "${callback}" ]]; then
|
||||
remaning_cleanups+=("${one_cleanup_handler}")
|
||||
remaining_cleanups+=("${one_cleanup_handler}")
|
||||
else
|
||||
run_one_cleanup_handler "${one_cleanup_handler}"
|
||||
fi
|
||||
done
|
||||
trap_manager_cleanup_handlers=("${remaning_cleanups[@]}")
|
||||
trap_manager_cleanup_handlers=("${remaining_cleanups[@]}")
|
||||
}
|
||||
|
||||
function run_one_cleanup_handler() {
|
||||
|
||||
@ -144,7 +144,6 @@ function main_default_build_single() {
|
||||
|
||||
# Compile armbian-firmware if packed .deb does not exist or use the one from repository
|
||||
if ! ls "${DEB_STORAGE}/armbian-firmware_${REVISION}_all.deb" 1> /dev/null 2>&1 || ! ls "${DEB_STORAGE}/armbian-firmware-full_${REVISION}_all.deb" 1> /dev/null 2>&1; then
|
||||
|
||||
if [[ "${REPOSITORY_INSTALL}" != *armbian-firmware* ]]; then
|
||||
compile_firmware_light_and_possibly_full # this has its own logging sections
|
||||
fi
|
||||
@ -165,18 +164,19 @@ function main_default_build_single() {
|
||||
LOG_SECTION="create_bsp_desktop_package" do_with_logging create_bsp_desktop_package
|
||||
fi
|
||||
|
||||
# skip image creation if exists. useful for CI when making a lot of images
|
||||
# skip image creation if exists. useful for CI when making a lot of images @TODO: hmm?
|
||||
if [ "$IMAGE_PRESENT" == yes ] && ls "${FINALDEST}/${VENDOR}_${REVISION}_${BOARD^}_${RELEASE}_${BRANCH}_${VER/-$LINUXFAMILY/}${DESKTOP_ENVIRONMENT:+_$DESKTOP_ENVIRONMENT}"*.xz 1> /dev/null 2>&1; then
|
||||
display_alert "Skipping image creation" "image already made - IMAGE_PRESENT is set" "wrn"
|
||||
exit
|
||||
fi
|
||||
|
||||
# build additional packages
|
||||
if [[ $EXTERNAL_NEW == compile ]]; then
|
||||
display_alert "Building external packages" "$EXTERNAL - WARNING: this has not been armbian-nextifed yet and will fail." "warn"
|
||||
exit_with_error "buildpkg chroot_build_packages() nas not been ported to armbian-next yet, rpardini is a bum"
|
||||
LOG_SECTION="chroot_build_packages" do_with_logging chroot_build_packages
|
||||
fi
|
||||
# @TODO: dead code, remove
|
||||
## DEAD CODE IN ARMBIAN-NEXT ## # build additional packages
|
||||
## DEAD CODE IN ARMBIAN-NEXT ## if [[ $EXTERNAL_NEW == compile ]]; then
|
||||
## DEAD CODE IN ARMBIAN-NEXT ## display_alert "Building external packages" "$EXTERNAL - WARNING: this has not been armbian-nextifed yet and will fail." "warn"
|
||||
## DEAD CODE IN ARMBIAN-NEXT ## exit_with_error "buildpkg chroot_build_packages() nas not been ported to armbian-next yet, rpardini is a bum"
|
||||
## DEAD CODE IN ARMBIAN-NEXT ## LOG_SECTION="chroot_build_packages" do_with_logging chroot_build_packages
|
||||
## DEAD CODE IN ARMBIAN-NEXT ## fi
|
||||
|
||||
# Reset owner of DEB_STORAGE, if needed. Might be a lot of packages there, but such is life.
|
||||
# @TODO: might be needed also during 'cleanup': if some package fails, the previous package might be left owned by root.
|
||||
|
||||
@ -20,12 +20,13 @@ function build_rootfs_and_image() {
|
||||
|
||||
# stage: verify tmpfs configuration and mount
|
||||
# CLI needs ~2GiB, desktop ~5GiB
|
||||
# vs 60% of available RAM (free + buffers + magic)
|
||||
local available_physical_memory_mib=$(($(awk '/MemAvailable/ {print $2}' /proc/meminfo) * 6 / 1024 / 10)) # MiB
|
||||
# vs 60% of "available" RAM (free + buffers + magic)
|
||||
declare -i available_physical_memory_mib
|
||||
available_physical_memory_mib=$(($(awk '/MemAvailable/ {print $2}' /proc/meminfo) * 6 / 1024 / 10)) # MiB
|
||||
|
||||
# @TODO: well those are very... arbitrary numbers.
|
||||
# @TODO: well those are very... arbitrary numbers. At least when using cached rootfs, we can be more precise.
|
||||
# predicting the size of tmpfs is hard/impossible, so would be nice to show the used size at the end so we can tune.
|
||||
local tmpfs_estimated_size=2000 # MiB
|
||||
declare -i tmpfs_estimated_size=2000 # MiB
|
||||
[[ $BUILD_DESKTOP == yes ]] && tmpfs_estimated_size=5000 # MiB
|
||||
|
||||
declare use_tmpfs=no # by default
|
||||
|
||||
Loading…
Reference in New Issue
Block a user