refactored Bootentry creation und removed unnecessary sleep

This commit is contained in:
eichehome 2023-03-30 12:56:37 +02:00
parent 38751ae4a7
commit 161d5e18b7

55
base.sh
View file

@ -17,8 +17,6 @@ else
exit 1 exit 1
fi fi
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 -r kernel read -r kernel
@ -48,8 +46,6 @@ else
exit 1 exit 1
fi fi
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 -r configuration read -r configuration
@ -73,6 +69,7 @@ if [[ $configuration == 2 ]]; then
elif [[ $configuration == 1 ]]; then elif [[ $configuration == 1 ]]; then
echo "Server" echo "Server"
fi fi
sleep 1 sleep 1
# Pacman Konfiguration # Pacman Konfiguration
@ -180,59 +177,57 @@ bootctl install
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/
#$selectedKernel="linux linux-lts linux-zen"
array_kernel_einzeln=$(echo "$selectedKernel" | tr " " "\n");
entry_conf=$(find / -type f -name entry.conf | grep configs)
for kernel_einzeln in $array_kernel_einzeln; do
boot_entry_name="${kernel_einzeln//linux/arch}";
# Standart
cp "$entry_conf" /boot/loader/entries/"$boot_entry_name".conf
sed -i "s/#KERNEL#/$kernel_einzeln/" /boot/loader/entries/"$boot_entry_name".conf
sed -i "s/#INITRAMFS#/$kernel_einzeln/" /boot/loader/entries/"$boot_entry_name".conf
title="${boot_entry_name//arch/arch-linux}"
sed -i "s/#TITLE#/$title/" /boot/loader/entries/"$boot_entry_name".conf
# Fallback
cp "$entry_conf" /boot/loader/entries/"$boot_entry_name".conf
sed -i "s/#KERNEL#/$kernel_einzeln/" /boot/loader/entries/"$boot_entry_name"-fallback.conf
sed -i "s/#INITRAMFS#/$kernel_einzeln-fallback/" /boot/loader/entries/"$boot_entry_name"-fallback.conf
title="${boot_entry_name//arch/arch-linux}-fallback"
sed -i "s/#TITLE#/$title/" /boot/loader/entries/"$boot_entry_name"-fallback.conf
done;
#TITLE#Arch Linux Zen Fallback
#KERNEL#linux-zen
#INITRAMFS#linux-zen-fallback
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
sed -i 's/#AMD//' /boot/loader/entries/arch.conf
elif [[ $vendor == 2 ]]; then
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
sed -i 's/#AMD//' /boot/loader/entries/arch-lts.conf
elif [[ $vendor == 2 ]]; then
sed -i 's/#Intel//' /boot/loader/entries/arch-lts.conf
fi
fi 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
sed -i 's/#AMD//' /boot/loader/entries/arch-zen.conf
elif [[ $vendor == 2 ]]; then
sed -i 's/#Intel//' /boot/loader/entries/arch-zen.conf
fi
fi 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 "$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
sed -i 's/#Intel//' /boot/loader/entries/arch-fallback.conf
fi
fi 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
sed -i 's/#AMD//' /boot/loader/entries/arch-lts-fallback.conf
elif [[ $vendor == 2 ]]; then
sed -i 's/#Intel//' /boot/loader/entries/arch-lts-fallback.conf
fi
fi fi
if [[ $kernel == 3 || $kernel == 4 || $kernel == 5 ]]; then if [[ $kernel == 3 || $kernel == 4 || $kernel == 5 ]]; then
@ -251,7 +246,7 @@ cryptroot_device_name=$(grep "LABEL=EFI" /etc/fstab | sed 's/#\s\/dev\/\(.\{3\}\
cryptroot_device_uuid=$(blkid -o value -s UUID /dev/"$cryptroot_device_name"2) cryptroot_device_uuid=$(blkid -o value -s UUID /dev/"$cryptroot_device_name"2)
#sed -i "s/root=LABEL=arch/root=\/dev\/mapper\/$cryptroot_name rd.luks.name=$cryptroot_device_uuid=$cryptroot_name/" /boot/loader/entries/arch.conf #sed -i "s/root=LABEL=arch/root=\/dev\/mapper\/$cryptroot_name rd.luks.name=$cryptroot_device_uuid=$cryptroot_name/" /boot/loader/entries/arch.conf
find . -type f -name arch\*.conf -exec sed -i "s/root=LABEL=arch/root=\/dev\/mapper\/$cryptroot_name rd.luks.name=$cryptroot_device_uuid=$cryptroot_name/" {} \; find /boot -type f -name arch\*.conf -exec sed -i "s/root=LABEL=arch/root=\/dev\/mapper\/$cryptroot_name rd.luks.name=$cryptroot_device_uuid=$cryptroot_name/" {} \;
useradd -mG wheel eichehome useradd -mG wheel eichehome
echo eichehome:testen | chpasswd echo eichehome:testen | chpasswd