Etwas Code hinzugefügt um möglicherweise die UUIDs der Partitionen zu bekommen.

This commit is contained in:
eichehome 2023-07-20 14:40:14 +02:00
parent 634411cd3e
commit a5af73b9ec

View file

@ -93,6 +93,37 @@ sgdisk -n 0:0:+64M -t 0: -c 0:"usrhash-Partition" "${DRIVE}"
# Create Root-Partition
sgdisk -n 0:0:0 -t 0:4f68bce3-e8cd-4db1-96e7-fbcaf984b709 -c 0:"System Root" "${DRIVE}"
# UUIDs finden
UUID_ESP=""
UUID_ROOT=""
UUID_USR=""
NOCASEMATCH_UNSET=$(shopt -u | grep -c nocasematch)
if [[ $NOCASEMATCH_UNSET ]]; then
shopt -s nocasematch
fi
for i in {1..9} ; do
OUTPUT=$(sgdisk -i "${i}" "${DRIVE}")
PARTITION_EXISTS=$(echo "${OUTPUT}" | grep -c 'Partition size')
if [[ $PARTITION_EXISTS ]]; then
GUID_CODE=$(echo "${OUTPUT}" | cut -d ' ' -f 4)
UUID=$(echo "${OUTPUT}" | sed 's/.*GUID: \s//' | cut -d ' ' -f 1)
case $GUID_CODE in
'8484680c-9521-48c6-9c11-b0720656f69e' ) echo "USR-Partition" ;;
'USR_HASH' ) echo "USRHASH-Partition" ;;
'c12a7328-f81f-11d2-ba4b-00a0c93ec93b' ) echo "ESP-Partition" ;;
'4f68bce3-e8cd-4db1-96e7-fbcaf984b709' ) echo "Root-Partition" ;;
* ) echo "Unbekannte Partition";;
esac
else
break;
fi
done
if [[ $NOCASEMATCH_UNSET ]]; then
shopt -u nocasematch
fi
mkfs.vfat -n EFI -F 32 /dev/vda1
mkfs.ext4 -L usr /dev/vda2