From 8fdfa6c77704fa2b67e53029a95d731c22fe0bbf Mon Sep 17 00:00:00 2001 From: rootzoll Date: Sun, 19 Jan 2025 00:09:08 +0100 Subject: [PATCH] optimiere die Erkennung der Bootpartition in blitz.data.sh --- home.admin/config.scripts/blitz.data.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/home.admin/config.scripts/blitz.data.sh b/home.admin/config.scripts/blitz.data.sh index dfaf29c29..a3fa6b501 100644 --- a/home.admin/config.scripts/blitz.data.sh +++ b/home.admin/config.scripts/blitz.data.sh @@ -927,10 +927,12 @@ if [ "$1" = "kill-boot" ]; then # get boot partition by checking filesystem type and flags bootPartition="" - for part in $(lsblk -no NAME "/dev/${device}" | grep "^${device}p\?[0-9]"); do - if blkid "/dev/${part}" | grep -q "TYPE=\"vfat\"" && \ - parted "/dev/${device}" print | grep "^ *[0-9]" | grep -q "boot\|esp"; then - bootPartition="${part}" + partitionNumber="" + for partNumber in $(parted -s "/dev/${device}" print | grep "^ *[0-9]" | awk '{print $1}'); do + if blkid "/dev/${device}${partNumber}" | grep -q "TYPE=\"vfat\"" && \ + parted "/dev/${device}" print | grep "^ *${partNumber}" | grep -q "boot\|esp"; then + bootPartition="${device}${partNumber}" + partitionNumber="${partNumber}" break fi done @@ -946,13 +948,6 @@ if [ "$1" = "kill-boot" ]; then exit 1 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 echo "# unmounting boot partition (${bootPartition}) (${partitionNumber})" exit 1