mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
armbian-next: many fixes after v29 rebase; mostly involving umount
- remove grub's --verbose, it's really too verbose - trust in TMPDIR, do not use trap at all in compile_plymouth-theme-armbian - settings traps adhoc is forbidden in armbian-next as well - be more verbose in umount_chroot(), do not try to unmount tmpfs-mounted dir itself, only xx/tmp - try to be smarter about /tmp being mounted in rootfs-to-image -- in the end the recursive saves us - run post_debootstrap_tweaks when the SDCARD is still mounted, not after - don't try to download anything from any mirrors if SKIP_ARMBIAN_REPO==yes
This commit is contained in:
@@ -108,7 +108,7 @@ pre_umount_final_image__install_grub() {
|
||||
}
|
||||
fi
|
||||
|
||||
local install_grub_cmdline="update-grub && grub-install --verbose --target=${UEFI_GRUB_TARGET} --no-nvram --removable" # nvram is global to the host, even across chroot. take care.
|
||||
local install_grub_cmdline="update-grub && grub-install --target=${UEFI_GRUB_TARGET} --no-nvram --removable" # nvram is global to the host, even across chroot. take care.
|
||||
display_alert "Installing GRUB EFI..." "${UEFI_GRUB_TARGET}" ""
|
||||
chroot_custom "$chroot_target" "$install_grub_cmdline" || {
|
||||
exit_with_error "${install_grub_cmdline} failed!"
|
||||
|
||||
@@ -200,7 +200,6 @@ compile_plymouth-theme-armbian() {
|
||||
local tmp_dir work_dir
|
||||
tmp_dir=$(mktemp -d)
|
||||
chmod 700 ${tmp_dir}
|
||||
trap "ret=\$?; rm -rf \"${tmp_dir}\" ; exit \$ret" 0 1 2 3 15
|
||||
plymouth_theme_armbian_dir=armbian-plymouth-theme_${REVISION}_all
|
||||
display_alert "Building deb" "armbian-plymouth-theme" "info"
|
||||
|
||||
|
||||
@@ -21,11 +21,13 @@ mount_chroot() {
|
||||
umount_chroot() {
|
||||
local target=$1
|
||||
display_alert "Unmounting" "$target" "info"
|
||||
while grep -Eq "${target}.*(dev|proc|sys|tmp)" /proc/mounts; do
|
||||
umount --recursive "${target}"/dev > /dev/null 2>&1 || true
|
||||
umount "${target}"/proc > /dev/null 2>&1 || true
|
||||
umount "${target}"/sys > /dev/null 2>&1 || true
|
||||
umount "${target}"/tmp > /dev/null 2>&1 || true
|
||||
while grep -Eq "${target}\/(dev|proc|sys|tmp)" /proc/mounts; do
|
||||
display_alert "Still things mounted at" "target: ${target}"
|
||||
run_host_command_logged grep -E "'${target}/(dev|proc|sys|tmp)'" /proc/mounts
|
||||
umount --recursive "${target}"/dev || true
|
||||
umount "${target}"/proc || true
|
||||
umount "${target}"/sys || true
|
||||
umount "${target}"/tmp || true
|
||||
sync
|
||||
done
|
||||
}
|
||||
|
||||
@@ -97,7 +97,9 @@ function prepare_partitions() {
|
||||
fi
|
||||
# Check if we need root partition
|
||||
[[ $ROOTFS_TYPE != nfs ]] &&
|
||||
local rootpart=$((next++))
|
||||
rootpart=$((next++))
|
||||
|
||||
display_alert "calculated rootpart" "rootpart: ${rootpart}" "debug"
|
||||
|
||||
# stage: calculate rootfs size
|
||||
export rootfs_size=$(du -sm $SDCARD/ | cut -f1) # MiB
|
||||
|
||||
@@ -80,9 +80,10 @@ create_image_from_sdcard_rootfs() {
|
||||
|
||||
# unmount /boot/efi first, then /boot, rootfs third, image file last
|
||||
sync
|
||||
[[ $UEFISIZE != 0 ]] && umount "${MOUNT}${UEFI_MOUNT_POINT}"
|
||||
[[ $BOOTSIZE != 0 ]] && umount "${MOUNT}/boot"
|
||||
umount "${MOUNT}"
|
||||
[[ $UEFISIZE != 0 ]] && run_host_command_logged umount "${MOUNT}${UEFI_MOUNT_POINT}"
|
||||
[[ $BOOTSIZE != 0 ]] && run_host_command_logged umount "${MOUNT}/boot"
|
||||
run_host_command_logged umount "${MOUNT}"/tmp || true
|
||||
run_host_command_logged umount "${MOUNT}" || true
|
||||
[[ $CRYPTROOT_ENABLE == yes ]] && cryptsetup luksClose $ROOT_MAPPER
|
||||
|
||||
umount_chroot_recursive "${MOUNT}" # @TODO: wait. NFS is not really unmounted above.
|
||||
|
||||
@@ -69,11 +69,11 @@ function build_rootfs_and_image() {
|
||||
# for reference, debugging / sanity checking
|
||||
LOG_SECTION="list_installed_packages" do_with_logging list_installed_packages
|
||||
|
||||
LOG_SECTION="post_debootstrap_tweaks" do_with_logging post_debootstrap_tweaks
|
||||
|
||||
# clean up / prepare for making the image
|
||||
umount_chroot "$SDCARD"
|
||||
|
||||
LOG_SECTION="post_debootstrap_tweaks" do_with_logging post_debootstrap_tweaks
|
||||
|
||||
# ------------------------------------ UP HERE IT's 'rootfs' stuff -------------------------------
|
||||
|
||||
#------------------------------------ DOWN HERE IT's 'image' stuff -------------------------------
|
||||
|
||||
@@ -40,9 +40,11 @@ get_or_create_rootfs_cache_chroot_sdcard() {
|
||||
|
||||
# if aria2 file exists download didn't succeeded
|
||||
if [[ ! -f $cache_fname || -f ${cache_fname}.aria2 ]]; then
|
||||
display_alert "Downloading from servers"
|
||||
download_and_verify "rootfs" "$cache_name" ||
|
||||
continue
|
||||
if [[ "${SKIP_ARMBIAN_REPO}" != "yes" ]]; then
|
||||
display_alert "Downloading from servers"
|
||||
download_and_verify "rootfs" "$cache_name" ||
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ -f $cache_fname && ! -f ${cache_fname}.aria2 ]] && break
|
||||
@@ -265,6 +267,7 @@ function create_new_rootfs_cache() {
|
||||
# based on rootfs size calculation
|
||||
umount_chroot "$SDCARD"
|
||||
|
||||
display_alert "zstd ball of rootfs" "$RELEASE:: $cache_name" "debug"
|
||||
tar cp --xattrs --directory=$SDCARD/ --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \
|
||||
--exclude='./sys/*' --exclude='./home/*' --exclude='./root/*' . | pv -p -b -r -s "$(du -sb $SDCARD/ | cut -f1)" -N "$(logging_echo_prefix_for_pv "store_rootfs") $cache_name" | zstdmt -5 -c > "${cache_fname}"
|
||||
|
||||
@@ -277,6 +280,8 @@ function create_new_rootfs_cache() {
|
||||
# needed for backend to keep current only
|
||||
echo "$cache_fname" > $cache_fname.current
|
||||
|
||||
display_alert "Cache prepared" "$RELEASE:: $cache_fname" "debug"
|
||||
|
||||
return 0 # protect against possible future short-circuiting above this
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user