From fcd73cd40535379516833b7a097c15d23687a99e Mon Sep 17 00:00:00 2001 From: eichehome Date: Wed, 29 Mar 2023 10:16:21 +0200 Subject: [PATCH] =?UTF-8?q?Selector=20f=C3=BCr=20Zieldevice=20hinzugef?= =?UTF-8?q?=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prep-BTRFS-UEFI-Encrypted.sh | 53 ++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/prep-BTRFS-UEFI-Encrypted.sh b/prep-BTRFS-UEFI-Encrypted.sh index 7a8b882..e5c011f 100644 --- a/prep-BTRFS-UEFI-Encrypted.sh +++ b/prep-BTRFS-UEFI-Encrypted.sh @@ -1,22 +1,51 @@ +#!/bin/bash + +#variable=$(dialog --title "" 3>&1 1>&2 2>&3 3>&-) + +#pacman -S dialog +#device_to_install_to=$(dialog --title "Device" --inputbox "Write the Path to the device to install to (eg. /dev/vda)" 3>&1 1>&2 2>&3 3>&-) + localectl set-keymap de-latin1-nodeadkeys timedatectl set-timezone Europe/Berlin timedatectl set-ntp yes -parted --script /dev/vda \ +echo "Choose Device: 1) /dev/sda 2) /dev/vda 3) Other Path" +read choise + +if [ $choise == 1 ];then + path="/dev/sda" + part1="/dev/sda1" + part2="/dev/sda2" +elif [ $choise == 2 ];then + path="/dev/vda" + part1="/dev/vda1" + part2="/dev/vda2" +elif [ $choise == 3 ];then + read -p "Enter Device-Path: " path + part1="$path"1 + part2="$path"2 +else + echo "Path not recognized, aborting" + exit 1 +fi + +cryptrootname="cryptroot" + +parted --script $path \ mklable gpt \ mkpart "efi" fat32 1MiB 501MiB \ set 1 esp on \ mkpart "root" btrfs 501MiB 100% -mkfs.vfat /dev/vda1 -n EFI -cryptsetup --cipher aes-xts-plain64 --hash sha512 --use-random --verify-passphrase luksFormat /dev/vda2 +mkfs.vfat $part1 -n EFI +cryptsetup --cipher aes-xts-plain64 --hash sha512 --use-random --verify-passphrase luksFormat $part2 -cryptsetup luksOpen /dev/vda2 cryptroot +cryptsetup luksOpen $part2 $cryptrootname -mkfs.btrfs /dev/mapper/cryptroot -L arch +mkfs.btrfs /dev/mapper/$cryptrootname -L arch -mount /dev/mapper/cryptroot /mnt +mount /dev/mapper/$cryptrootname /mnt cd /mnt btrfs subvolume create @ btrfs subvolume create @home @@ -26,15 +55,15 @@ btrfs subvolume create @cache cd ~ umount -R /mnt -mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@ /dev/mapper/cryptroot /mnt +mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@ /dev/mapper/$cryptrootname /mnt mkdir -p /mnt/{home,boot,var} -mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@home /dev/mapper/cryptroot /mnt/home -mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@var /dev/mapper/cryptroot /mnt/var +mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@home /dev/mapper/$cryptrootname /mnt/home +mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@var /dev/mapper/$cryptrootname /mnt/var mkdir -p /mnt/var/{cache,log} -mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@log /dev/mapper/cryptroot /mnt/var/log -mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@cache /dev/mapper/cryptroot /mnt/var/cache +mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@log /dev/mapper/$cryptrootname /mnt/var/log +mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@cache /dev/mapper/$cryptrootname /mnt/var/cache -mount /dev/vda1 /mnt/boot +mount $part1 /mnt/boot pacstrap /mnt base linux linux-lts linux-zen linux-firmware amd-ucode vim git btrfs-progs