From 1d29f6c8f1b58531ebe479ed26079b923a6b2243 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Thu, 9 Jul 2026 18:31:41 +0000 Subject: [PATCH] armbian_rootenc_setup: new _create_boot_fs() function --- scripts/armbian_rootenc_setup.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/armbian_rootenc_setup.sh b/scripts/armbian_rootenc_setup.sh index 9fd59a9..4dff0a4 100755 --- a/scripts/armbian_rootenc_setup.sh +++ b/scripts/armbian_rootenc_setup.sh @@ -874,6 +874,14 @@ _print_config_vars() { if [ "$outfile" ]; then echo "$data" > $outfile; else echo "$data"; fi } +_create_boot_fs() { + local fstype=$(lsblk --noheadings --list --output=FSTYPE "/dev/$BOOT_DEVNAME") + [ "$fstype" == 'ext4' -a "$ROOTENC_REUSE_FS" ] || { + mkfs.ext4 -F "/dev/$BOOT_DEVNAME" + } + do_partprobe +} + create_partitions() { local p1_end p2_start cmds1 cmds2 bname rname fstype p1_end=$((start_sector + boot_partition_sectors - 1)) @@ -909,9 +917,7 @@ create_partitions() { [ "$rname" == $ROOT_DEVNAME ] || die 'Partitioning failed!' # boot partition filesystem is required by call to _add_state_file(), so we must create it here - fstype=$(lsblk --noheadings --list --output=FSTYPE "/dev/$BOOT_DEVNAME") - [ "$fstype" == 'ext4' -a "$ROOTENC_REUSE_FS" ] || mkfs.ext4 -F "/dev/$BOOT_DEVNAME" - do_partprobe + _create_boot_fs _add_state_file 'card_partitioned' 'mount' }