Compare commits
No commits in common. "9668f9d7616e071a43d7382856860ce2a54dd207" and "9b6fef22eb51a2060b972d2a7b8156235d59de4d" have entirely different histories.
9668f9d761
...
9b6fef22eb
1 changed files with 74 additions and 206 deletions
264
install.uefi
264
install.uefi
|
@ -50,8 +50,7 @@ PRINT=(cups)
|
|||
# Development
|
||||
DEV=(base-devel "${KERNEL}-headers")
|
||||
# Netzwerk
|
||||
WIFI_BACKEND=(wpa_supplicant) # iwd
|
||||
NET=(iptables-nft firewalld inetutils avahi networkmanager networkmanager-openconnect networkmanager-openvpn networkmanager-pptp networkmanager-vpnc "${WIFI_BACKEND[@]}" modemmanager) # bind(dig,host,nslookup)
|
||||
NET=(iptables-nft firewalld inetutils avahi networkmanager networkmanager-openconnect networkmanager-openvpn networkmanager-pptp networkmanager-vpnc modemmanager) #iwd bind(dig,host,nslookup)
|
||||
# Sontiges
|
||||
BASE=(base) # -sudo
|
||||
INITRD=(mkinitcpio) # dracut
|
||||
|
@ -70,10 +69,7 @@ fi
|
|||
DRIVE="/dev/vda"
|
||||
# disklayout: ESP (512MiB), usr (15GiB), Root (100% - [512MiB + 15GiB])
|
||||
ESP="512M"
|
||||
USR="10G"
|
||||
ROOT_LABEL="root"
|
||||
USR_LABEL="usr"
|
||||
ESP_LABEL="EFI"
|
||||
USR="15G"
|
||||
|
||||
#--------------------------#
|
||||
|
||||
|
@ -87,203 +83,92 @@ ESP_LABEL="EFI"
|
|||
# /usr /dev/vda2
|
||||
# (usr-hash) /dev/vda3
|
||||
# /(root) /dev/vda4
|
||||
|
||||
#LSBLK_OPTIONEN="NAME,PARTUUID,UUID,PARTTYPE,PARTN,LABEL,MOUNTPOINTS"
|
||||
|
||||
# Prüfen ob die Platte existiert
|
||||
#declare -i CHECK_EXISTENCE_OUTPUT=""
|
||||
CHECK_EXISTENCE_OUTPUT=$(lsblk -o NAME | grep -c "^${DRIVE//\/dev\/}")
|
||||
if [[ ${CHECK_EXISTENCE_OUTPUT} -lt 1 ]]; then
|
||||
echo "Platte existiert nicht, breche ab."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
RECREATE_PARTITIONS="1"
|
||||
|
||||
# Prüfe ob die Platte schon formatiert wurde und die Partitionen da sind
|
||||
CHECK_PARTITIONS_OUTPUT=$(lsblk -o NAME,PARTTYPE | grep "${DRIVE//\/dev\/}" | grep "\(c12a7328-f81f-11d2-ba4b-00a0c93ec93b\|8484680c-9521-48c6-9c11-b0720656f69e\|77ff5f63-e7b6-4633-acf4-1565b864c0e6\|4f68bce3-e8cd-4db1-96e7-fbcaf984b709\)")
|
||||
CHECK_ROOT=$(echo "${CHECK_PARTITIONS_OUTPUT}" | grep -c "4f68bce3-e8cd-4db1-96e7-fbcaf984b709")
|
||||
CHECK_ESP=$(echo "${CHECK_PARTITIONS_OUTPUT}" | grep -c "c12a7328-f81f-11d2-ba4b-00a0c93ec93b")
|
||||
CHECK_USR=$(echo "${CHECK_PARTITIONS_OUTPUT}" | grep -c "8484680c-9521-48c6-9c11-b0720656f69e")
|
||||
CHECK_USRHASH=$(echo "${CHECK_PARTITIONS_OUTPUT}" | grep -c "77ff5f63-e7b6-4633-acf4-1565b864c0e6")
|
||||
if [[ ${CHECK_ESP} -eq 1 && ${CHECK_USR} -eq 1 && ${CHECK_USRHASH} -eq 1 && ${CHECK_ROOT} -eq 1 ]]; then
|
||||
read -r "Alle Partitionen sind vorhanden. Trotzdem neu erstellen? (j/N): " confirm
|
||||
if [[ "${confirm}" == [jJ] ]];then
|
||||
echo "Partitionen werden neu erstellt"
|
||||
RECREATE_PARTITIONS="1"
|
||||
else
|
||||
echo "Partitionen werden nicht neu erstellt"
|
||||
RECREATE_PARTITIONS="0"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${RECREATE_PARTITIONS} -eq 1 ]]; then
|
||||
# Reset Partition Table
|
||||
sgdisk -og "${DRIVE}"
|
||||
# EFI System Partition erstellen
|
||||
# Create EFI System Partition
|
||||
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:ef00 -c 0:ESP "${DRIVE}"
|
||||
# usr-Partition erstellen
|
||||
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" "${DRIVE}"
|
||||
# Root-Partition erstellen
|
||||
sgdisk -n 0:0:0 -t 0:4f68bce3-e8cd-4db1-96e7-fbcaf984b709 -c 0:"ArchOS Root" "${DRIVE}"
|
||||
# Create usr-Partition
|
||||
sgdisk -n 0:0:+"${USR}" -t 0:8484680c-9521-48c6-9c11-b0720656f69e -c 0:"Usr-Partition" "${DRIVE}"
|
||||
# Create usrhash-Partition
|
||||
sgdisk -n 0:0:+512M -t 0:77ff5f63-e7b6-4633-acf4-1565b864c0e6 -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=""
|
||||
UUID_USRHASH=""
|
||||
|
||||
# Anzahl der Partitionen ermitteln
|
||||
DRIVE_NAME=${DRIVE//\/dev\/}
|
||||
declare -i NUMBER_OF_PARTITIONS;
|
||||
NUMBER_OF_PARTITIONS=$(lsblk | grep -c "${DRIVE_NAME}[0-9]")
|
||||
declare -i UNKNOWN_PARTITIONS
|
||||
|
||||
NOCASEMATCH_UNSET=$(shopt -u | grep -c nocasematch)
|
||||
if [[ $NOCASEMATCH_UNSET ]]; then
|
||||
shopt -s nocasematch
|
||||
fi
|
||||
|
||||
# # UUIDs finden
|
||||
# UUID_ESP=""
|
||||
# UUID_ROOT=""
|
||||
# UUID_USR=""
|
||||
# UUID_USRHASH=""
|
||||
|
||||
# # Anzahl der Partitionen ermitteln
|
||||
# DRIVE_NAME=${DRIVE//\/dev\/}
|
||||
# declare -i NUMBER_OF_PARTITIONS;
|
||||
# NUMBER_OF_PARTITIONS=$(lsblk | grep -c "${DRIVE_NAME}[0-9]")
|
||||
# declare -i UNKNOWN_PARTITIONS
|
||||
|
||||
# NOCASEMATCH_UNSET=$(shopt -u | grep -c nocasematch)
|
||||
# if [[ $NOCASEMATCH_UNSET ]]; then
|
||||
# shopt -s nocasematch
|
||||
# fi
|
||||
|
||||
# for (( i=NUMBER_OF_PARTITIONS; i > 0 ; i=i-1 )) ; do
|
||||
# OUTPUT=$(sgdisk -i "${i}" "${DRIVE}")
|
||||
# PARTITION_EXISTS=$(echo "${OUTPUT}" | grep -c "GUID")
|
||||
# if [[ "${PARTITION_EXISTS}" != "0" ]]; then
|
||||
# GUID_CODE=$(echo "${OUTPUT}" | grep "GUID code:" | cut -d ' ' -f 4)
|
||||
# UUID=$(echo "${OUTPUT}" | grep "unique GUID:" | cut -d ' ' -f 4)
|
||||
# case $GUID_CODE in
|
||||
# "8484680c-9521-48c6-9c11-b0720656f69e" )
|
||||
# echo "USR-Partition, UUID: ${UUID}"
|
||||
# UUID_USR=${UUID}
|
||||
# ;;
|
||||
# "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" )
|
||||
# echo "ESP-Partition, UUID: ${UUID}"
|
||||
# UUID_ESP=${UUID}
|
||||
# ;;
|
||||
# "4f68bce3-e8cd-4db1-96e7-fbcaf984b709" )
|
||||
# echo "Root-Partition, UUID: ${UUID}"
|
||||
# UUID_ROOT=${UUID}
|
||||
# ;;
|
||||
# "77ff5f63-e7b6-4633-acf4-1565b864c0e6" )
|
||||
# echo "Usrhash-Partition, UUID: ${UUID}"
|
||||
# UUID_USRHASH=${UUID}
|
||||
# ;;
|
||||
# * )
|
||||
# echo "Unbekannte Partition"
|
||||
# UNKNOWN_PARTITIONS="${UNKNOWN_PARTITIONS}+1"
|
||||
# ;;
|
||||
# esac
|
||||
# else
|
||||
# echo "no partition found"
|
||||
# fi
|
||||
# NUMBER_OF_PARTITIONS="${NUMBER_OF_PARTITIONS}-1"
|
||||
# done
|
||||
|
||||
# if [[ $NOCASEMATCH_UNSET ]]; then
|
||||
# shopt -u nocasematch
|
||||
# fi
|
||||
|
||||
# if [[ "${UNKNOWN_PARTITIONS}" -gt "0" ]]; then
|
||||
# if [[ "${UNKNOWN_PARTITIONS}" -gt "1" ]]; then
|
||||
# read -r -p "Mehrere Partitionen unbekannt. Trotzdem fortfahren? (j/N): " confirm
|
||||
# [[ "${confirm}" == [jJ] ]] || echo "Abbrechen" && exit 0
|
||||
# else
|
||||
# read -r -p "Eine Partition unbekannt. Trotzdem fortfahren? (j/N): " confirm
|
||||
# [[ "${confirm}" == [jJ] ]] || echo "Abbrechen" && exit 0
|
||||
# fi
|
||||
# fi
|
||||
|
||||
# # Großbuchstaben in UUIDs zu kleinbuchstaben umwandeln
|
||||
# UUID_ESP="${UUID_ESP@L}"
|
||||
# UUID_ROOT="${UUID_ROOT@L}"
|
||||
# UUID_USR="${UUID_USR@L}"
|
||||
# UUID_USRHASH="${UUID_USRHASH@L}"
|
||||
|
||||
# Informationen aus den Partitionen auslesen
|
||||
PARTITIONEN_OUTPUT=$(lsblk -o NAME,PARTTYPE,PARTUUID,UUID,PARTN,LABEL,MOUNTPOINTS | grep "${DRIVE//\/dev\/}[0-9]" | sed 's/[[:blank:]]\+/ /g')
|
||||
echo "PARTITIONEN_OUTPUT:"
|
||||
echo "${PARTITIONEN_OUTPUT}"
|
||||
PARTITION_NUMBERS=$(echo "${PARTITIONEN_OUTPUT}" | cut -d ' ' -f 5)
|
||||
echo "Partition-Numbers:"
|
||||
echo "${PARTITION_NUMBERS}"
|
||||
|
||||
declare -A ROOT_PARTITION=()
|
||||
declare -A ESP_PARTITION=()
|
||||
declare -A USR_PARTITION=()
|
||||
declare -A USRHASH_PARTITION=()
|
||||
|
||||
for i in ${PARTITION_NUMBERS}; do
|
||||
PARTN=$(echo "${PARTITIONEN_OUTPUT}" | grep "${DRIVE//\/dev\/}${i}" | cut -d ' ' -f 5)
|
||||
PARTUUID=$(echo "${PARTITIONEN_OUTPUT}" | grep "${DRIVE//\/dev\/}${i}" | cut -d ' ' -f 3)
|
||||
PARTTYPE=$(echo "${PARTITIONEN_OUTPUT}" | grep "${DRIVE//\/dev\/}${i}" | cut -d ' ' -f 2)
|
||||
case $PARTTYPE in
|
||||
"c12a7328-f81f-11d2-ba4b-00a0c93ec93b" )
|
||||
echo "ESP"
|
||||
ESP_PARTITION+=([PARTUUID]="${PARTUUID}")
|
||||
ESP_PARTITION+=([PARTTYPE]="${PARTTYPE}")
|
||||
ESP_PARTITION+=([PARTNUMBER]="${PARTN}")
|
||||
;;
|
||||
for (( i=NUMBER_OF_PARTITIONS; i > 0 ; i=i-1 )) ; do
|
||||
OUTPUT=$(sgdisk -i "${i}" "${DRIVE}")
|
||||
PARTITION_EXISTS=$(echo "${OUTPUT}" | grep -c "GUID")
|
||||
if [[ "${PARTITION_EXISTS}" != "0" ]]; then
|
||||
GUID_CODE=$(echo "${OUTPUT}" | grep "GUID code:" | cut -d ' ' -f 4)
|
||||
UUID=$(echo "${OUTPUT}" | grep "unique GUID:" | cut -d ' ' -f 4)
|
||||
case $GUID_CODE in
|
||||
"8484680c-9521-48c6-9c11-b0720656f69e" )
|
||||
echo "USR"
|
||||
USR_PARTITION+=([PARTUUID]="${PARTUUID}")
|
||||
USR_PARTITION+=([PARTTYPE]="${PARTTYPE}")
|
||||
USR_PARTITION+=([PARTNUMBER]="${PARTN}")
|
||||
echo "USR-Partition, UUID: ${UUID}"
|
||||
UUID_USR=${UUID}
|
||||
;;
|
||||
"77ff5f63-e7b6-4633-acf4-1565b864c0e6")
|
||||
echo "USRHASH"
|
||||
USRHASH_PARTITION+=([PARTUUID]="${PARTUUID}")
|
||||
USRHASH_PARTITION+=([PARTTYPE]="${PARTTYPE}")
|
||||
USRHASH_PARTITION+=([PARTNUMBER]="${PARTN}")
|
||||
"c12a7328-f81f-11d2-ba4b-00a0c93ec93b" )
|
||||
echo "ESP-Partition, UUID: ${UUID}"
|
||||
UUID_ESP=${UUID}
|
||||
;;
|
||||
"4f68bce3-e8cd-4db1-96e7-fbcaf984b709" )
|
||||
echo "ROOT"
|
||||
ROOT_PARTITION+=([PARTUUID]="${PARTUUID}")
|
||||
ROOT_PARTITION+=([PARTTYPE]="${PARTTYPE}")
|
||||
ROOT_PARTITION+=([PARTNUMBER]="${PARTN}")
|
||||
echo "Root-Partition, UUID: ${UUID}"
|
||||
UUID_ROOT=${UUID}
|
||||
;;
|
||||
"77ff5f63-e7b6-4633-acf4-1565b864c0e6" )
|
||||
echo "Usrhash-Partition, UUID: ${UUID}"
|
||||
UUID_USRHASH=${UUID}
|
||||
;;
|
||||
* )
|
||||
echo "Unknown"
|
||||
echo "Unbekannte Partition"
|
||||
UNKNOWN_PARTITIONS="${UNKNOWN_PARTITIONS}+1"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "no partition found"
|
||||
fi
|
||||
NUMBER_OF_PARTITIONS="${NUMBER_OF_PARTITIONS}-1"
|
||||
done
|
||||
|
||||
# Prüfen,ob die Dateisysteme schon korrekt sind
|
||||
FILESYSTEM_OUTPUT=$(lsblk -o NAME,FSTYPE,FSVER,PARTUUID | grep "${DRIVE//\/dev\/}[0-9]")
|
||||
CHECK_FS_ESP=$(echo "${FILESYSTEM_OUTPUT}" | grep "${ESP_PARTITION["PARTUUID"]}" | grep -i "vfat" | grep -i "fat32" | grep -c -i "${ESP_LABEL}")
|
||||
CHECK_FS_USR=$(echo "${FILESYSTEM_OUTPUT}" | grep "${USR_PARTITION["PARTUUID"]}" | grep -i "ext4" | grep -c -i "${USR_LABEL}")
|
||||
CHECK_FS_USRHASH=$(echo "${FILESYSTEM_OUTPUT}" | grep "${USRHASH_PARTITION["PARTUUID"]}" | grep -c -i "dm_verity_hash")
|
||||
CHECK_FS_ROOT=$(echo "${FILESYSTEM_OUTPUT}" | grep "${ROOT_PARTITION["PARTUUID"]}" | grep -i "ext4" | grep -c -i "${ROOT_LABEL}")
|
||||
if [[ $NOCASEMATCH_UNSET ]]; then
|
||||
shopt -u nocasematch
|
||||
fi
|
||||
|
||||
RECREATE_FILESYSTEMS="0"
|
||||
if [[ ${CHECK_FS_ESP} -eq 1 && ${CHECK_FS_USR} -eq 1 && ${CHECK_FS_USRHASH} -eq 1 && ${CHECK_FS_ROOT} -eq 1 ]]; then
|
||||
echo "Alles vorhanden"
|
||||
read -r "Alle Dateisysteme vorhanden. Trotzdem neu erstellen? (j/N): " confirm
|
||||
if [[ ${confirm} == [jJ] ]]; then
|
||||
echo "Dateisysteme werden neuerstellt."
|
||||
RECREATE_FILESYSTEMS="1"
|
||||
if [[ "${UNKNOWN_PARTITIONS}" > "0" ]]; then
|
||||
if [[ "${UNKNOWN_PARTITIONS}" > "1" ]]; then
|
||||
read -r -p "Mehrere Partitionen unbekannt. Trotzdem fortfahren? (j/N): " confirm
|
||||
[[ "${confirm}" == [jJ] ]] || echo "Abbrechen" && exit 0
|
||||
else
|
||||
echo "Dateisysteme werden nicht neu erstellt."
|
||||
RECREATE_FILESYSTEMS="0"
|
||||
read -r -p "Eine Partition unbekannt. Trotzdem fortfahren? (j/N): " confirm
|
||||
[[ "${confirm}" == [jJ] ]] || echo "Abbrechen" && exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ (${CHECK_ESP} -eq 0 || ${RECREATE_FILESYSTEMS} -eq 1) && -n ${ESP_PARTITION["PARTUUID"]} ]]; then
|
||||
echo "Erstelle ESP"
|
||||
mkfs.vfat -n "${ESP_LABEL}" -F 32 "/dev/disk/by-partuuid/${ESP_PARTITION["PARTUUID"]}"
|
||||
fi
|
||||
# Großbuchstaben in UUIDs zu kleinbuchstaben umwandeln
|
||||
UUID_ESP="${UUID_ESP@L}"
|
||||
UUID_ROOT="${UUID_ROOT@L}"
|
||||
UUID_USR="${UUID_USR@L}"
|
||||
UUID_USRHASH="${UUID_USRHASH@L}"
|
||||
|
||||
if [[ (${CHECK_USR} -eq 0 || ${RECREATE_FILESYSTEMS} -eq 1) && -n ${USR_PARTITION["PARTUUID"]} ]]; then
|
||||
echo "Erstelle USR"
|
||||
mkfs.ext4 -L "${USR_LABEL}" "/dev/disk/by-partuuid/${USR_PARTITION["PARTUUID"]}"
|
||||
fi
|
||||
|
||||
if [[ (${CHECK_ROOT} -eq 0 || ${RECREATE_FILESYSTEMS} -eq 1) && -n ${ROOT_PARTITION["PARTUUID"]} ]]; then
|
||||
echo "Erstelle ROOT"
|
||||
mkfs.ext4 -L "${ROOT_LABEL}" "/dev/disk/by-partuuid/${ROOT_PARTITION["PARTUUID"]}"
|
||||
fi
|
||||
mkfs.vfat -n EFI -F 32 "/dev/disk/by-partuuid/${UUID_ESP}"
|
||||
mkfs.ext4 -L usr "/dev/disk/by-partuuid/${UUID_USR}"
|
||||
mkfs.ext4 -L root "/dev/disk/by-partuuid/${UUID_ROOT}"
|
||||
|
||||
mount /dev/disk/by-label/root /mnt
|
||||
mkdir -p /mnt/{boot,usr}
|
||||
|
@ -433,23 +318,6 @@ initrd /initramfs-${KERNEL}.img
|
|||
options quiet splash rw
|
||||
EOF
|
||||
|
||||
#--------------------------#
|
||||
|
||||
###############
|
||||
# Veritysetup #
|
||||
###############
|
||||
|
||||
echo "veritysetup"
|
||||
|
||||
OUTPUT_VERITYSETUP=$(veritysetup format /dev/vda2 /dev/vda3)
|
||||
ROOT_HASH=$(echo "${OUTPUT_VERITYSETUP}" | grep "Root hash" | sed 's/[[:blank:]]\+/ /g' | cut -d ' ' -f 3)
|
||||
ROOTHASH_TEIL="${ROOT_HASH:0:32}"
|
||||
|
||||
lsblk
|
||||
|
||||
#sgdisk -u (partnum /USR):(64 char roothash)(UUID_USRHASH)
|
||||
|
||||
|
||||
#--------------------------#
|
||||
|
||||
##################
|
||||
|
|
Loading…
Reference in a new issue