linted scripts
This commit is contained in:
parent
43585a5bb9
commit
f5fea9a87c
2 changed files with 32 additions and 30 deletions
38
base.sh
38
base.sh
|
@ -1,7 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
# Vor Reboot
|
# Vor Reboot
|
||||||
echo "Select Prozessor Vendor:"
|
echo "Select Prozessor Vendor:"
|
||||||
echo "1) AMD 2) Intel 3) Other(no ucode)"
|
echo "1) AMD 2) Intel 3) Other(no ucode)"
|
||||||
read vendor
|
read -r vendor
|
||||||
if [[ $vendor == 1 ]]; then
|
if [[ $vendor == 1 ]]; then
|
||||||
echo "AMD"
|
echo "AMD"
|
||||||
ucode="amd-ucode"
|
ucode="amd-ucode"
|
||||||
|
@ -20,7 +21,7 @@ sleep 1
|
||||||
|
|
||||||
echo "Select Kernel"
|
echo "Select Kernel"
|
||||||
echo "1) Linux 2) Linux+lts 3) Linux+zen 4) Linux+zen+lts 5) zen+lts"
|
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
|
if [[ $kernel == 1 ]]; then
|
||||||
echo "Linux"
|
echo "Linux"
|
||||||
|
@ -51,14 +52,14 @@ sleep 1
|
||||||
|
|
||||||
echo "General configuration:"
|
echo "General configuration:"
|
||||||
echo "1) Server (Systemd-networkd, no graphics card) 2) Laptop/Desktop (Networkmanager, Graphics Card)"
|
echo "1) Server (Systemd-networkd, no graphics card) 2) Laptop/Desktop (Networkmanager, Graphics Card)"
|
||||||
read configuration
|
read -r configuration
|
||||||
|
|
||||||
if [[ $configuration == 2 ]]; then
|
if [[ $configuration == 2 ]]; then
|
||||||
echo "Laptop/Desktop"
|
echo "Laptop/Desktop"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Graphics Card"
|
echo "Graphics Card"
|
||||||
echo "1) AMD 2) Intel 3) Nvidia"
|
echo "1) AMD 2) Intel 3) Nvidia"
|
||||||
read gracard
|
read -r gracard
|
||||||
|
|
||||||
if [[ $gracard == 1 ]]; then
|
if [[ $gracard == 1 ]]; then
|
||||||
echo "AMD"
|
echo "AMD"
|
||||||
|
@ -67,7 +68,7 @@ if [[ $configuration == 2 ]]; then
|
||||||
elif [[ $gracard == 3 ]]; then
|
elif [[ $gracard == 3 ]]; then
|
||||||
echo "Nvidia"
|
echo "Nvidia"
|
||||||
else
|
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
|
fi
|
||||||
elif [[ $configuration == 1 ]]; then
|
elif [[ $configuration == 1 ]]; then
|
||||||
echo "Server"
|
echo "Server"
|
||||||
|
@ -99,8 +100,8 @@ echo "127.0.1.1 arch.localedomain arch" >> /etc/hosts
|
||||||
echo root:test | chpasswd
|
echo root:test | chpasswd
|
||||||
|
|
||||||
|
|
||||||
pacman -S $selectedKernel $ucode
|
pacman -S "$selectedKernel" "$ucode"
|
||||||
pacman -S base-devel $headers
|
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
|
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
|
# Netzwerk
|
||||||
# Ethernet
|
# Ethernet
|
||||||
ethernet_network=$(find / -type f -name 20-ethernet.network | grep configs)
|
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
|
||||||
wlan_network=$(find / -type f -name 20-wlan.network | grep configs)
|
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 (Mobilefunk)
|
||||||
wwan_network=$(find / -type f -name 20-wwan.network | grep configs)
|
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
|
elif [[ $configuration == 2 ]]; then
|
||||||
systemctl enable NetworkManager
|
systemctl enable NetworkManager
|
||||||
wifi_backend_conf=$(find / -type f -name wifi_backend.conf | grep configs)
|
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
|
fi
|
||||||
|
|
||||||
systemctl enable systemd-resolved
|
systemctl enable systemd-resolved
|
||||||
|
@ -170,22 +171,23 @@ bootctl install
|
||||||
|
|
||||||
# Bootloaderconfig
|
# Bootloaderconfig
|
||||||
loader_conf=$(find / -type f -name loader.conf | grep configs)
|
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
|
if [[ $kernel == 1 || $kernel == 2 || $kernel == 3 || $kernel == 4 ]]; then
|
||||||
# Entry Arch
|
# Entry Arch
|
||||||
arch_conf=$(find / -type f -name arch.conf | grep configs)
|
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
|
if [[ $vendor == 1 ]]; then
|
||||||
sed -i 's/#AMD//' /boot/loader/entries/arch.conf
|
sed -i 's/#AMD//' /boot/loader/entries/arch.conf
|
||||||
elif [[ $vendor == 2 ]]; then
|
elif [[ $vendor == 2 ]]; then
|
||||||
sed -i 's/#Intel//' /boot/loader/entries/arch.conf
|
sed -i 's/#Intel//' /boot/loader/entries/arch.conf
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $kernel == 2 || $kernel == 4 || $kernel == 5 ]]; then
|
if [[ $kernel == 2 || $kernel == 4 || $kernel == 5 ]]; then
|
||||||
# Entry Arch LTS
|
# Entry Arch LTS
|
||||||
arch_lts_conf=$(find / -type f -name arch-lts.conf | grep configs)
|
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
|
if [[ $vendor == 1 ]]; then
|
||||||
sed -i 's/#AMD//' /boot/loader/entries/arch-lts.conf
|
sed -i 's/#AMD//' /boot/loader/entries/arch-lts.conf
|
||||||
elif [[ $vendor == 2 ]]; then
|
elif [[ $vendor == 2 ]]; then
|
||||||
|
@ -196,7 +198,7 @@ fi
|
||||||
if [[ $kernel == 3 || $kernel == 4 || $kernel == 5 ]]; then
|
if [[ $kernel == 3 || $kernel == 4 || $kernel == 5 ]]; then
|
||||||
# Entry Arch Zen
|
# Entry Arch Zen
|
||||||
arch_zen_conf=$(find / -type f -name arch-zen.conf | grep configs)
|
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
|
if [[ $vendor == 1 ]]; then
|
||||||
sed -i 's/#AMD//' /boot/loader/entries/arch-zen.conf
|
sed -i 's/#AMD//' /boot/loader/entries/arch-zen.conf
|
||||||
elif [[ $vendor == 2 ]]; then
|
elif [[ $vendor == 2 ]]; then
|
||||||
|
@ -207,7 +209,7 @@ fi
|
||||||
if [[ $kernel == 1 || $kernel == 2 || $kernel == 3 || $kernel == 4 ]]; then
|
if [[ $kernel == 1 || $kernel == 2 || $kernel == 3 || $kernel == 4 ]]; then
|
||||||
# Entry Arch Fallback
|
# Entry Arch Fallback
|
||||||
arch_fallback_conf=$(find / -type f -name arch-fallback.conf | grep configs)
|
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
|
if [[ $vendor == 1 ]]; then
|
||||||
sed -i 's/#AMD//' /boot/loader/entries/arch-fallback.conf
|
sed -i 's/#AMD//' /boot/loader/entries/arch-fallback.conf
|
||||||
elif [[ $vendor == 2 ]]; then
|
elif [[ $vendor == 2 ]]; then
|
||||||
|
@ -218,7 +220,7 @@ fi
|
||||||
if [[ $kernel == 2 || $kernel == 4 || $kernel == 5 ]]; then
|
if [[ $kernel == 2 || $kernel == 4 || $kernel == 5 ]]; then
|
||||||
# Entry Arch LTS Fallback
|
# Entry Arch LTS Fallback
|
||||||
arch_lts_fallback_conf=$(find / -type f -name arch-lts-fallback.conf | grep configs)
|
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
|
if [[ $vendor == 1 ]]; then
|
||||||
sed -i 's/#AMD//' /boot/loader/entries/arch-lts-fallback.conf
|
sed -i 's/#AMD//' /boot/loader/entries/arch-lts-fallback.conf
|
||||||
elif [[ $vendor == 2 ]]; then
|
elif [[ $vendor == 2 ]]; then
|
||||||
|
@ -229,7 +231,7 @@ fi
|
||||||
if [[ $kernel == 3 || $kernel == 4 || $kernel == 5 ]]; then
|
if [[ $kernel == 3 || $kernel == 4 || $kernel == 5 ]]; then
|
||||||
# Entry Arch Zen Fallback
|
# Entry Arch Zen Fallback
|
||||||
arch_zen_fallback_conf=$(find / -type f -name arch-zen-fallback.conf | grep configs)
|
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
|
if [[ $vendor == 1 ]]; then
|
||||||
sed -i 's/#AMD//' /boot/loader/entries/arch-zen-fallback.conf
|
sed -i 's/#AMD//' /boot/loader/entries/arch-zen-fallback.conf
|
||||||
elif [[ $vendor == 2 ]]; then
|
elif [[ $vendor == 2 ]]; then
|
||||||
|
|
|
@ -11,18 +11,18 @@ timedatectl set-timezone Europe/Berlin
|
||||||
timedatectl set-ntp yes
|
timedatectl set-ntp yes
|
||||||
|
|
||||||
echo "Choose Device: 1) /dev/sda 2) /dev/vda 3) Other Path"
|
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"
|
path="/dev/sda"
|
||||||
part1="/dev/sda1"
|
part1="/dev/sda1"
|
||||||
part2="/dev/sda2"
|
part2="/dev/sda2"
|
||||||
elif [ $choise == 2 ];then
|
elif [ "$choise" == 2 ];then
|
||||||
path="/dev/vda"
|
path="/dev/vda"
|
||||||
part1="/dev/vda1"
|
part1="/dev/vda1"
|
||||||
part2="/dev/vda2"
|
part2="/dev/vda2"
|
||||||
elif [ $choise == 3 ];then
|
elif [ "$choise" == 3 ];then
|
||||||
read -p "Enter Device-Path: " path
|
read -r -p "Enter Device-Path: " path
|
||||||
part1="$path"1
|
part1="$path"1
|
||||||
part2="$path"2
|
part2="$path"2
|
||||||
else
|
else
|
||||||
|
@ -32,27 +32,27 @@ fi
|
||||||
|
|
||||||
cryptrootname="cryptroot"
|
cryptrootname="cryptroot"
|
||||||
|
|
||||||
parted --script $path \
|
parted --script "$path" \
|
||||||
mklabel gpt \
|
mklabel gpt \
|
||||||
mkpart "efi" fat32 1MiB 501MiB \
|
mkpart "efi" fat32 1MiB 501MiB \
|
||||||
set 1 esp on \
|
set 1 esp on \
|
||||||
mkpart "root" btrfs 501MiB 100%
|
mkpart "root" btrfs 501MiB 100%
|
||||||
|
|
||||||
mkfs.vfat $part1 -n EFI
|
mkfs.vfat "$part1" -n EFI
|
||||||
cryptsetup --cipher aes-xts-plain64 --hash sha512 --use-random --verify-passphrase luksFormat $part2
|
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
|
mkfs.btrfs /dev/mapper/$cryptrootname -L arch
|
||||||
|
|
||||||
mount /dev/mapper/$cryptrootname /mnt
|
mount /dev/mapper/$cryptrootname /mnt
|
||||||
cd /mnt
|
cd /mnt || exit 1
|
||||||
btrfs subvolume create @
|
btrfs subvolume create @
|
||||||
btrfs subvolume create @home
|
btrfs subvolume create @home
|
||||||
btrfs subvolume create @var
|
btrfs subvolume create @var
|
||||||
btrfs subvolume create @log
|
btrfs subvolume create @log
|
||||||
btrfs subvolume create @cache
|
btrfs subvolume create @cache
|
||||||
cd ~
|
cd ~ || exit 1
|
||||||
umount -R /mnt
|
umount -R /mnt
|
||||||
|
|
||||||
mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@ /dev/mapper/$cryptrootname /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=@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 -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
|
pacstrap /mnt base linux-firmware vim git btrfs-progs
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue