Compare commits

...

2 commits

Author SHA1 Message Date
eichehome 09876ec680 Test-Script um Dateisystem-Check existiert. 2023-07-26 00:55:09 +02:00
eichehome 782a54efff Modifiziert Prepare-Script. 2023-07-26 00:54:08 +02:00
2 changed files with 63 additions and 60 deletions

View file

@ -1,18 +1,22 @@
#!/bin/bash
if true ; then
sgdisk -og "${DRIVE}"
sgdisk -og /dev/vda
# EFI System Partition erstellen
sgdisk -n 0:0:+"${ESP}" -t 0:c12a7328-f81f-11d2-ba4b-00a0c93ec93b -c 0:"EFI System Partition" "${DRIVE}"
sgdisk -n 0:0:+512M -t 0:c12a7328-f81f-11d2-ba4b-00a0c93ec93b -c 0:"EFI System Partition" /dev/vda
# usr-Partition erstellen
sgdisk -n 0:0:+"${USR}" -t 0:8484680c-9521-48c6-9c11-b0720656f69e -c 0:"ArchOS_0.1" "${DRIVE}"
sgdisk -n 0:0:+10G -t 0:8484680c-9521-48c6-9c11-b0720656f69e -c 0:"ArchOS_0.1" /dev/vda
# usrhash-Partition erstellen
sgdisk -n 0:0:+512M -t 0:77ff5f63-e7b6-4633-acf4-1565b864c0e6 -c 0:"ArchOS_0.1" "${DRIVE}"
sgdisk -n 0:0:+512M -t 0:77ff5f63-e7b6-4633-acf4-1565b864c0e6 -c 0:"ArchOS_0.1" /dev/vda
# Root-Partition erstellen
sgdisk -n 0:0:0 -t 0:4f68bce3-e8cd-4db1-96e7-fbcaf984b709 -c 0:"ArchOS Root" "${DRIVE}"
sgdisk -n 0:0:0 -t 0:4f68bce3-e8cd-4db1-96e7-fbcaf984b709 -c 0:"ArchOS Root" /dev/vda
fi
if true ; then
if false ; then
mkfs.vfat -F 32 -n EFI /dev/vda1
fi
if false ; then
mkfs.ext4 -L usr /dev/vda2
fi
if false ; then
mkfs.ext4 -L root /dev/vda4
fi

107
test.uefi
View file

@ -10,22 +10,24 @@ ESP_LABEL="EFI"
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
CHECK_EXISTENCE_OUTPUT=$(lsblk -o NAME | grep -c "^${DRIVE//\/dev\/}")
# Prüfen, ob Drive existiert
if [[ ${CHECK_EXISTENCE_OUTPUT} -lt 1 ]]; then
CHECK_PARTITION_EXISTENCE_OUTPUT=$(lsblk -pldo NAME | grep -ic "${DRIVE}")
if [[ ${CHECK_PARTITION_EXISTENCE_OUTPUT} -eq 1 ]]; then
echo "Platte existiert nicht, Abbruch!"
exit 1
else
echo "Platte existiert , Weitermachen."
fi
#----------------------------#
RECREATE_PARTITIONS="1"
# Prüfen, ob Partitionen existieren ung ggf. erstellen
declare -A PARTITIONS_PRESENT=()
CHECK_PARTITIONS_OUTPUT=$(lsblk -po NAME,PARTTYPE | grep "${DRIVE}[0-9]")
CHECK_PARTITIONS_OUTPUT=$(lsblk -pldo NAME,PARTTYPE "${DRIVE}[0-9]")
CHECK_ESP=$(echo "${CHECK_PARTITIONS_OUTPUT}" | grep -c "c12a7328-f81f-11d2-ba4b-00a0c93ec93b")
PARTITIONS_PRESENT+=([ESP]="${CHECK_ESP}")
@ -106,58 +108,55 @@ else
fi
fi
# if [[ ${PARTITIONS_PRESENT[ROOT]} -eq 1 ]]; then
# echo "Root-Partition vorhanden."
# read -r -p "Partition trotzdem neuerstellen? (j/N): " confirm_root
# if [[ ${confirm_root} == [jJ] ]]; then
# echo "Root-Partition wird neu erstellt"
# echo sgdisk -n 0:
# else
# echo "Root-Partition wird nicht neu erstellt"
# fi
# else
# echo "Root-Partition nicht vorhanden."
# fi
# if [[ ${PARTITIONS_PRESENT[USR]} -eq 1 ]]; then
# echo "/usr-Partition vorhanden."
# read -r -p "Partition trotzdem neuerstellen? (j/N): " confirm_usr
# if [[ ${confirm_usr} == [jJ] ]]; then
# echo "/usr-Partition wird neu erstellt"
# else
# echo "/usr-Partition wird nicht neu erstellt"
# fi
# else
# echo "/usr-Partition nicht vorhanden."
# fi
# if [[ ${PARTITIONS_PRESENT[USRHASH]} -eq 1 ]]; then
# echo "/usr-Verity-Partition vorhanden."
# read -r -p "Partition trotzdem neuerstellen? (j/N): " confirm_usrhash
# if [[ ${confirm_usrhash} == [jJ] ]]; then
# echo "/usr-Verity-Partition wird neu erstellt"
# else
# echo "/usr-Verity-Partition wird nicht neu erstellt"
# fi
# else
# echo "/usr-Verity-Partition nicht vorhanden."
# fi
# if [[ ${PARTITIONS_PRESENT[ESP]} -eq 1 ]]; then
# echo "ESP-Partition vorhanden."
# read -r -p "Partition trotzdem neuerstellen? (j/N): " confirm_esp
# if [[ ${confirm_esp} == [jJ] ]]; then
# echo "ESP-Partition wird neu erstellt"
# else
# echo "ESP-Partition wird nicht neu erstellt"
# fi
# else
# echo "ESP-Partition nicht vorhanden."
# fi
# _______ _ _ ___________ _ _ ___ _ ______
# /\ / ______ \| | | |___ _____| | | | \ | |/ ___ \
# / \ | | \/| |_____| | | | | | | | |\ \ | | / \_|
# / /\ \ | | | | | | | | | | | \ \ | | | ___
# / /__\ \ | | | _____ | | | | | | | | \ \ | | | |_ |
# / ______ \| |_____/\| | | | | | \ \____/ | | \ \| | \___| |
#/_/ \_\________/|_| |_| |_| \________/|_| \___|\_______|
#/_/ \_\________/|_| |_| |_| \________/|_| \___|\_______|
#----------------------------#
#----------------------------#
CHECK_FS_EXISTENCE_OUTPUT=$(lsblk -pldo NAME,PARTUUID,PARTTYPE,FSTYPE,FSVER "${DRIVE}[0-9]")
declare -A INFO_ESP=""
declare -A INFO_USR=""
declare -A INFO_USRHASH=""
declare -A INFO_ROOT=""
CHECK_FS_ESP=$(echo "${CHECK_FS_EXISTENCE_OUTPUT}" | grep -i "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" | grep -i "vfat" | grep -ic "fast32")
CHECK_FS_USR=$(echo "${CHECK_FS_EXISTENCE_OUTPUT}" | grep -i "8484680c-9521-48c6-9c11-b0720656f69e" | grep -ic "ext4")
CHECK_FS_USRHASH=$(echo "${CHECK_FS_EXISTENCE_OUTPUT}" | grep -i "77ff5f63-e7b6-4633-acf4-1565b864c0e6" | grep -ic "dm_verity_hash")
CHECK_FS_ROOT=$(echo "${CHECK_FS_EXISTENCE_OUTPUT}" | grep -i "4f68bce3-e8cd-4db1-96e7-fbcaf984b709" | grep -i "ext4")
if [[ ${CHECK_ESP} -eq 0 ]]; then
echo "ESP-Dateisystem existiert nicht."
else
echo "ESP-Dateisystem existiert."
fi
if [[ ${CHECK_FS_USR} -eq 0 ]]; then
echo "/usr-Dateisystem existiert nicht."
else
echo "/usr-Dateisystem existiert."
fi
if [[ ${CHECK_FS_USRHASH} -eq 0 ]]; then
echo "Dateisystem existiert nicht."
else
echo "Dateisystem existiert."
fi
if [[ ${CHECK_FS_ROOT} -eq 0 ]]; then
echo "Root-Dateisystem existiert nicht."
else
echo "Root-Dateisystem existiert."
fi