mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
improve(lvm,cryptroot): export private key with a structurally equal naming scheme; cleanup
This commit is contained in:
@@ -252,21 +252,19 @@ function prepare_partitions() {
|
||||
|
||||
# stage: mount image
|
||||
# lock access to loop devices
|
||||
exec {FD}> /var/lock/armbian-debootstrap-losetup
|
||||
flock -x $FD
|
||||
|
||||
#--partscan is using to force the kernel for scanning partition table in preventing of partprobe errors
|
||||
if [[ -z $LOOP ]]; then
|
||||
exec {FD}> /var/lock/armbian-debootstrap-losetup
|
||||
flock -x $FD
|
||||
|
||||
LOOP=$(losetup -f)
|
||||
# LOOP=$(losetup --show --partscan --find "${SDCARD}".raw) || exit_with_error "Unable to find free loop device"
|
||||
[[ -z $LOOP ]] && exit_with_error "Unable to find free loop device"
|
||||
display_alert "Allocated loop device" "LOOP=${LOOP}"
|
||||
check_loop_device "$LOOP"
|
||||
check_loop_device "${LOOP}"
|
||||
losetup $LOOP ${SDCARD}.raw
|
||||
fi
|
||||
|
||||
# loop device was grabbed here, unlock
|
||||
flock -u $FD
|
||||
# loop device was grabbed here, unlock
|
||||
flock -u $FD
|
||||
fi
|
||||
|
||||
display_alert "Running partprobe" "${LOOP}" "debug"
|
||||
run_host_command_logged partprobe "${LOOP}"
|
||||
@@ -320,6 +318,7 @@ function prepare_partitions() {
|
||||
echo "$CRYPTROOT_MAPPER UUID=${physical_root_part_uuid} none luks" >> $SDCARD/etc/crypttab
|
||||
run_host_command_logged cat $SDCARD/etc/crypttab
|
||||
fi
|
||||
|
||||
rootfs="UUID=$(blkid -s UUID -o value $rootdevice)"
|
||||
echo "$rootfs / ${mkfs[$ROOTFS_TYPE]} defaults,noatime${mountopts[$ROOTFS_TYPE]} 0 1" >> $SDCARD/etc/fstab
|
||||
run_host_command_logged cat $SDCARD/etc/fstab
|
||||
|
||||
@@ -117,7 +117,7 @@ function create_image_from_sdcard_rootfs() {
|
||||
fi
|
||||
|
||||
wait_for_disk_sync "before umount MOUNT"
|
||||
|
||||
|
||||
umount_chroot_recursive "${MOUNT}" "MOUNT"
|
||||
|
||||
call_extension_method "post_umount_final_image" "config_post_umount_final_image" <<- 'POST_UMOUNT_FINAL_IMAGE'
|
||||
|
||||
@@ -54,17 +54,12 @@ function trap_handler_cleanup_rootfs_and_image() {
|
||||
display_alert "Cleanup for rootfs and image" "trap_handler_cleanup_rootfs_and_image" "cleanup"
|
||||
|
||||
debug_tmpfs_show_usage "before cleanup of rootfs"
|
||||
|
||||
cd "${SRC}" || echo "Failed to cwd to ${SRC}" # Move pwd away, so unmounts work
|
||||
|
||||
# those will loop until they're unmounted.
|
||||
display_alert "Cleanup sdcard begin" "trap_handler_cleanup_rootfs_and_image" "cleanup"
|
||||
umount_chroot_recursive "${SDCARD}" "SDCARD" || true
|
||||
|
||||
display_alert "Cleanup mount begin" "trap_handler_cleanup_rootfs_and_image" "cleanup"
|
||||
umount_chroot_recursive "${MOUNT}" "MOUNT" || true
|
||||
|
||||
display_alert "Cleanup umount sdcard begin" "trap_handler_cleanup_rootfs_and_image" "cleanup"
|
||||
# unmount tmpfs mounted on SDCARD if it exists. #@TODO: move to new tmpfs-utils scheme
|
||||
mountpoint -q "${SDCARD}" && umount "${SDCARD}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user