Skip to content

Commit

Permalink
make the fat partition detection work on gpt
Browse files Browse the repository at this point in the history
We were checking for the mbr type of 'c'. Instead of checking for that
and the GUID for a generic MS data partition, make things easier and
just check that it's a vfat filesystem. With that, the 4MB, and the
subsequent check for the label this appears to be enough belts and
suspenders.

Signed-off-by: Dirk Hohndel <[email protected]>
  • Loading branch information
dirkhh committed Sep 9, 2023
1 parent c801382 commit 2cac348
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .build/images/dietpi-build
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ case $HW_MODEL in
79) iname='NanoPi6' HW_ARCH=3 root_size=752;; # Special case: Skips image file, partitioning and filesystem generation, but runs debootstrap only!
80) iname='OrangePi5' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=752;;
81) iname='VisionFive2' HW_ARCH=11 root_size=639;;
82) iname='OrangePi5Plus' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=752;;
82) iname='OrangePi5Plus' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=952;;
*) G_DIETPI-NOTIFY 1 "Invalid hardware model \"$HW_MODEL\" passed, aborting..."; exit 1;;
esac

Expand Down
5 changes: 3 additions & 2 deletions rootfs/var/lib/dietpi/services/fs_partition_resize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
exit 1
fi

# check if the last partition is a 4MB partition with the Windows/FAT type
if sfdisk -l "$ROOT_DRIVE" | tail -1 | grep -E "\s4M\s+c\s" > /dev/null 2>&1
# check if the last partition is a 4MB partition with a vfat filesystem
LAST_FS_TYPE=$(lsblk -no FSTYPE "$ROOT_DRIVE" | tail -1)
if sfdisk -l "$ROOT_DRIVE" | tail -1 | grep -E "\s4M\s" > /dev/null 2>&1 && [[ $LAST_FS_TYPE = 'vfat' ]]
then
# the last partition is a 4M FAT filesystem - let's check if it is ours
SETUP_PART=$(sfdisk -l "$ROOT_DRIVE" | tail -1 | mawk '{print $1}')
Expand Down

0 comments on commit 2cac348

Please sign in to comment.