diff --git a/base.sh b/base.sh index 09b7190..6ab0900 100644 --- a/base.sh +++ b/base.sh @@ -1,7 +1,8 @@ +#!/bin/bash # Vor Reboot echo "Select Prozessor Vendor:" echo "1) AMD 2) Intel 3) Other(no ucode)" -read vendor +read -r vendor if [[ $vendor == 1 ]]; then echo "AMD" ucode="amd-ucode" @@ -20,7 +21,7 @@ sleep 1 echo "Select Kernel" echo "1) Linux 2) Linux+lts 3) Linux+zen 4) Linux+zen+lts 5) zen+lts" -read kernel +read -r kernel if [[ $kernel == 1 ]]; then echo "Linux" @@ -51,14 +52,14 @@ sleep 1 echo "General configuration:" echo "1) Server (Systemd-networkd, no graphics card) 2) Laptop/Desktop (Networkmanager, Graphics Card)" -read configuration +read -r configuration if [[ $configuration == 2 ]]; then echo "Laptop/Desktop" echo "" echo "Graphics Card" echo "1) AMD 2) Intel 3) Nvidia" - read gracard + read -r gracard if [[ $gracard == 1 ]]; then echo "AMD" @@ -67,7 +68,7 @@ if [[ $configuration == 2 ]]; then elif [[ $gracard == 3 ]]; then echo "Nvidia" else - read -p "No Graphics Card selected. Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1 + read -r -p "No Graphics Card selected. Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1 fi elif [[ $configuration == 1 ]]; then echo "Server" @@ -99,8 +100,8 @@ echo "127.0.1.1 arch.localedomain arch" >> /etc/hosts echo root:test | chpasswd -pacman -S $selectedKernel $ucode -pacman -S base-devel $headers +pacman -S "$selectedKernel" "$ucode" +pacman -S base-devel "$header" pacman -S iwd dialog reflector xdg-user-dirs xdg-utils inetutils ldns bash-completion openssh rsync iptables-nft ipset firewalld lynx @@ -122,17 +123,17 @@ if [[ $configuration == 1 ]]; then # Netzwerk # Ethernet ethernet_network=$(find / -type f -name 20-ethernet.network | grep configs) - cp ./configs/20-ethernet.network /etc/systemd/network/ + cp "$ethernet_network" /etc/systemd/network/ # Wlan wlan_network=$(find / -type f -name 20-wlan.network | grep configs) - cp $wlan_network /etc/systemd/network/ + cp "$wlan_network" /etc/systemd/network/ # Wwan (Mobilefunk) wwan_network=$(find / -type f -name 20-wwan.network | grep configs) - cp $wwan_network /etc/systemd/network/ + cp "$wwan_network" /etc/systemd/network/ elif [[ $configuration == 2 ]]; then systemctl enable NetworkManager wifi_backend_conf=$(find / -type f -name wifi_backend.conf | grep configs) - cp $wifi_backend_conf /etc/NetworkManager/conf.d/ + cp "$wifi_backend_conf" /etc/NetworkManager/conf.d/ fi systemctl enable systemd-resolved @@ -170,22 +171,23 @@ bootctl install # Bootloaderconfig loader_conf=$(find / -type f -name loader.conf | grep configs) -cp $loader_conf /boot/loader/ +cp "$loader_conf" /boot/loader/ if [[ $kernel == 1 || $kernel == 2 || $kernel == 3 || $kernel == 4 ]]; then # Entry Arch arch_conf=$(find / -type f -name arch.conf | grep configs) - cp $arch_conf /boot/loader/entries/ + cp "$arch_conf" /boot/loader/entries/ if [[ $vendor == 1 ]]; then sed -i 's/#AMD//' /boot/loader/entries/arch.conf elif [[ $vendor == 2 ]]; then sed -i 's/#Intel//' /boot/loader/entries/arch.conf fi +fi if [[ $kernel == 2 || $kernel == 4 || $kernel == 5 ]]; then # Entry Arch LTS arch_lts_conf=$(find / -type f -name arch-lts.conf | grep configs) - cp $arch_lts_conf /boot/loader/entries/ + cp "$arch_lts_conf" /boot/loader/entries/ if [[ $vendor == 1 ]]; then sed -i 's/#AMD//' /boot/loader/entries/arch-lts.conf elif [[ $vendor == 2 ]]; then @@ -196,7 +198,7 @@ fi if [[ $kernel == 3 || $kernel == 4 || $kernel == 5 ]]; then # Entry Arch Zen arch_zen_conf=$(find / -type f -name arch-zen.conf | grep configs) - cp $arch_zen_conf /boot/loader/entries/ + cp "$arch_zen_conf" /boot/loader/entries/ if [[ $vendor == 1 ]]; then sed -i 's/#AMD//' /boot/loader/entries/arch-zen.conf elif [[ $vendor == 2 ]]; then @@ -207,7 +209,7 @@ fi if [[ $kernel == 1 || $kernel == 2 || $kernel == 3 || $kernel == 4 ]]; then # Entry Arch Fallback arch_fallback_conf=$(find / -type f -name arch-fallback.conf | grep configs) - cp ./configs/arch-fallback.conf /boot/loader/entries/ + cp "$arch_fallback_conf" /boot/loader/entries/ if [[ $vendor == 1 ]]; then sed -i 's/#AMD//' /boot/loader/entries/arch-fallback.conf elif [[ $vendor == 2 ]]; then @@ -218,7 +220,7 @@ fi if [[ $kernel == 2 || $kernel == 4 || $kernel == 5 ]]; then # Entry Arch LTS Fallback arch_lts_fallback_conf=$(find / -type f -name arch-lts-fallback.conf | grep configs) - cp $arch_lts_fallback_conf /boot/loader/entries/ + cp "$arch_lts_fallback_conf" /boot/loader/entries/ if [[ $vendor == 1 ]]; then sed -i 's/#AMD//' /boot/loader/entries/arch-lts-fallback.conf elif [[ $vendor == 2 ]]; then @@ -229,7 +231,7 @@ fi if [[ $kernel == 3 || $kernel == 4 || $kernel == 5 ]]; then # Entry Arch Zen Fallback arch_zen_fallback_conf=$(find / -type f -name arch-zen-fallback.conf | grep configs) - cp $arch_zen_fallback_conf /boot/loader/entries/ + cp "$arch_zen_fallback_conf" /boot/loader/entries/ if [[ $vendor == 1 ]]; then sed -i 's/#AMD//' /boot/loader/entries/arch-zen-fallback.conf elif [[ $vendor == 2 ]]; then diff --git a/prep-BTRFS-UEFI-Encrypted.sh b/prep-BTRFS-UEFI-Encrypted.sh index 053acdf..99d7930 100644 --- a/prep-BTRFS-UEFI-Encrypted.sh +++ b/prep-BTRFS-UEFI-Encrypted.sh @@ -11,18 +11,18 @@ timedatectl set-timezone Europe/Berlin timedatectl set-ntp yes echo "Choose Device: 1) /dev/sda 2) /dev/vda 3) Other Path" -read choise +read -r choise -if [ $choise == 1 ];then +if [ "$choise" == 1 ];then path="/dev/sda" part1="/dev/sda1" part2="/dev/sda2" -elif [ $choise == 2 ];then +elif [ "$choise" == 2 ];then path="/dev/vda" part1="/dev/vda1" part2="/dev/vda2" -elif [ $choise == 3 ];then - read -p "Enter Device-Path: " path +elif [ "$choise" == 3 ];then + read -r -p "Enter Device-Path: " path part1="$path"1 part2="$path"2 else @@ -32,27 +32,27 @@ fi cryptrootname="cryptroot" -parted --script $path \ +parted --script "$path" \ mklabel gpt \ mkpart "efi" fat32 1MiB 501MiB \ set 1 esp on \ mkpart "root" btrfs 501MiB 100% -mkfs.vfat $part1 -n EFI -cryptsetup --cipher aes-xts-plain64 --hash sha512 --use-random --verify-passphrase luksFormat $part2 +mkfs.vfat "$part1" -n EFI +cryptsetup --cipher aes-xts-plain64 --hash sha512 --use-random --verify-passphrase luksFormat "$part2" -cryptsetup luksOpen $part2 $cryptrootname +cryptsetup luksOpen "$part2" $cryptrootname mkfs.btrfs /dev/mapper/$cryptrootname -L arch mount /dev/mapper/$cryptrootname /mnt -cd /mnt +cd /mnt || exit 1 btrfs subvolume create @ btrfs subvolume create @home btrfs subvolume create @var btrfs subvolume create @log btrfs subvolume create @cache -cd ~ +cd ~ || exit 1 umount -R /mnt mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@ /dev/mapper/$cryptrootname /mnt @@ -63,7 +63,7 @@ mkdir -p /mnt/var/{cache,log} 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 $part1 /mnt/boot +mount "$part1" /mnt/boot pacstrap /mnt base linux-firmware vim git btrfs-progs