optimiere die Erkennung der Bootpartition in blitz.data.sh

This commit is contained in:
rootzoll
2025-01-19 00:09:08 +01:00
parent 625f664ea7
commit 8fdfa6c777

View File

@@ -927,10 +927,12 @@ if [ "$1" = "kill-boot" ]; then
# get boot partition by checking filesystem type and flags # get boot partition by checking filesystem type and flags
bootPartition="" bootPartition=""
for part in $(lsblk -no NAME "/dev/${device}" | grep "^${device}p\?[0-9]"); do partitionNumber=""
if blkid "/dev/${part}" | grep -q "TYPE=\"vfat\"" && \ for partNumber in $(parted -s "/dev/${device}" print | grep "^ *[0-9]" | awk '{print $1}'); do
parted "/dev/${device}" print | grep "^ *[0-9]" | grep -q "boot\|esp"; then if blkid "/dev/${device}${partNumber}" | grep -q "TYPE=\"vfat\"" && \
bootPartition="${part}" parted "/dev/${device}" print | grep "^ *${partNumber}" | grep -q "boot\|esp"; then
bootPartition="${device}${partNumber}"
partitionNumber="${partNumber}"
break break
fi fi
done done
@@ -946,13 +948,6 @@ if [ "$1" = "kill-boot" ]; then
exit 1 exit 1
fi fi
# get partition number from device name
partitionNumber=$(echo "${bootPartition}" | grep -o '[0-9]*$')
if [ "${partitionNumber}" = "" ]; then
echo "error='partition number not found'"
exit 1
fi
# make sure boot partition is not mounted # make sure boot partition is not mounted
echo "# unmounting boot partition (${bootPartition}) (${partitionNumber})" echo "# unmounting boot partition (${bootPartition}) (${partitionNumber})"
exit 1 exit 1