diff --git a/prepare.uefi b/prepare.uefi index b79afbf..7b67f66 100644 --- a/prepare.uefi +++ b/prepare.uefi @@ -1,22 +1,18 @@ #!/bin/bash if true ; then - sgdisk -og /dev/vda + sgdisk -og "${DRIVE}" # EFI System Partition erstellen - sgdisk -n 0:0:+512M -t 0:c12a7328-f81f-11d2-ba4b-00a0c93ec93b -c 0:"EFI System Partition" /dev/vda + sgdisk -n 0:0:+"${ESP}" -t 0:c12a7328-f81f-11d2-ba4b-00a0c93ec93b -c 0:"EFI System Partition" "${DRIVE}" # usr-Partition erstellen - sgdisk -n 0:0:+10G -t 0:8484680c-9521-48c6-9c11-b0720656f69e -c 0:"ArchOS_0.1" /dev/vda + sgdisk -n 0:0:+"${USR}" -t 0:8484680c-9521-48c6-9c11-b0720656f69e -c 0:"ArchOS_0.1" "${DRIVE}" # usrhash-Partition erstellen - sgdisk -n 0:0:+512M -t 0:77ff5f63-e7b6-4633-acf4-1565b864c0e6 -c 0:"ArchOS_0.1" /dev/vda + sgdisk -n 0:0:+512M -t 0:77ff5f63-e7b6-4633-acf4-1565b864c0e6 -c 0:"ArchOS_0.1" "${DRIVE}" # Root-Partition erstellen - sgdisk -n 0:0:0 -t 0:4f68bce3-e8cd-4db1-96e7-fbcaf984b709 -c 0:"ArchOS Root" /dev/vda + sgdisk -n 0:0:0 -t 0:4f68bce3-e8cd-4db1-96e7-fbcaf984b709 -c 0:"ArchOS Root" "${DRIVE}" fi -if false ; then +if true ; 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 \ No newline at end of file diff --git a/test.uefi b/test.uefi index ce68e8c..3dc8560 100644 --- a/test.uefi +++ b/test.uefi @@ -10,24 +10,22 @@ ESP_LABEL="EFI" #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# Prüfen, ob Drive existiert +CHECK_EXISTENCE_OUTPUT=$(lsblk -o NAME | grep -c "^${DRIVE//\/dev\/}") -CHECK_PARTITION_EXISTENCE_OUTPUT=$(lsblk -pldo NAME | grep -ic "${DRIVE}") - -if [[ ${CHECK_PARTITION_EXISTENCE_OUTPUT} -eq 1 ]]; then +if [[ ${CHECK_EXISTENCE_OUTPUT} -lt 1 ]]; then echo "Platte existiert nicht, Abbruch!" exit 1 else echo "Platte existiert , Weitermachen." fi + #----------------------------# -# Prüfen, ob Partitionen existieren ung ggf. erstellen - +RECREATE_PARTITIONS="1" declare -A PARTITIONS_PRESENT=() -CHECK_PARTITIONS_OUTPUT=$(lsblk -pldo NAME,PARTTYPE "${DRIVE}[0-9]") +CHECK_PARTITIONS_OUTPUT=$(lsblk -po NAME,PARTTYPE | grep "${DRIVE}[0-9]") CHECK_ESP=$(echo "${CHECK_PARTITIONS_OUTPUT}" | grep -c "c12a7328-f81f-11d2-ba4b-00a0c93ec93b") PARTITIONS_PRESENT+=([ESP]="${CHECK_ESP}") @@ -108,55 +106,58 @@ 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 \ No newline at end of file +#/_/ \_\________/|_| |_| |_| \________/|_| \___|\_______| \ No newline at end of file