feat: Kernel selection

master
phga 3 years ago
parent c247962743
commit 8b4a6d73f0
Signed by: phga
GPG Key ID: 5249548AA705F019

@ -7,6 +7,7 @@ do case $opt in
d) DEV=${OPTARG} ;; d) DEV=${OPTARG} ;;
e) ENC=${OPTARG} ;; e) ENC=${OPTARG} ;;
s) SWAP_SIZE=${OPTARG} ;; s) SWAP_SIZE=${OPTARG} ;;
k) KERNEL=${OPTARG} ;;
\?) echo "-$OPTARG is not valid" >&2 && exit ;; \?) echo "-$OPTARG is not valid" >&2 && exit ;;
esac esac
done done
@ -19,17 +20,20 @@ init() {
echo "+---------------------------+" echo "+---------------------------+"
echo "" echo ""
[ -z "$NAME" ] && read -p "Hostname: " NAME [ -z "$NAME" ] && read -p "Hostname: " NAME
while [ -z "$PASSWD" ] || [ ! "$PASSWD" = "$CHECK" ]; do while [ -z "$PASSWD" ] || [ ! "$PASSWD" == "$CHECK" ]; do
read -sp "Root password: " PASSWD read -sp "Root password: " PASSWD
echo echo
read -sp "Repeat: " CHECK read -sp "Repeat: " CHECK
done done
# Show some possible disks # Show some possible disks
[ -z "$DEV" ] && lsblk -nrpo "name,size,model" && read -p "Provide installation medium (e.g. sda, nvme0n1): " DEV [ -z "$DEV" ] && lsblk -nrpo "name,size,model" &&
read -p "Provide installation medium (e.g. sda, nvme0n1): " DEV
[[ "$DEV" =~ sd[a-z] ]] && SUF="1-3" && MODE="SATA" [[ "$DEV" =~ sd[a-z] ]] && SUF="1-3" && MODE="SATA"
[[ "$DEV" =~ nvme[0-9]n[0-9] ]] && SUF="p1-3" && MODE="NVME" [[ "$DEV" =~ nvme[0-9]n[0-9] ]] && SUF="p1-3" && MODE="NVME"
[ -z "$SWAP_SIZE" ] && read -p "Specify the size for the SWAP partition (16G, 1M, ...): " SWAP_SIZE [ -z "$SWAP_SIZE" ] && read -p "Specify the size for the SWAP partition (16G, 1M, ...): " SWAP_SIZE
[ -z "$ENC" ] && read -p "Do you want the root partition to be encrypted (y/n)? " ENC [ -z "$ENC" ] && read -p "Do you want the root partition to be encrypted (y/n)? " ENC
[ -z "$KERNEL" ] && read -p "Which kernel? [1: linux, 2: linux-zen]" KERNEL
[ "$KERNEL" == "1" ] && KERNEL="linux" || KERNEL="linux-zen"
[ "$ENC" == "y" ] && ENC=true || ENC=false [ "$ENC" == "y" ] && ENC=true || ENC=false
echo "+---------------------+" echo "+---------------------+"
@ -40,8 +44,9 @@ init() {
echo "DEVICEPARTS = $DEV$SUF" echo "DEVICEPARTS = $DEV$SUF"
echo "SWAP_SIZE = $SWAP_SIZE" echo "SWAP_SIZE = $SWAP_SIZE"
echo "ENCRYPTION = $ENC" echo "ENCRYPTION = $ENC"
echo "KERNEL = $KERNEL"
read -p "Do you want to continue with these values (y/n)? " cont read -p "Do you want to continue with these values (y/n)? " cont
[ ! "$cont" = "y" ] && unset NAME PASSWD DEV ENC && init [ ! "$cont" == "y" ] && unset NAME PASSWD DEV ENC SWAP_SIZE KERNEL && init
echo "Let's GOOOO" echo "Let's GOOOO"
} }
@ -125,7 +130,7 @@ cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
sed -i '/.*\.de\/.*/!d' /etc/pacman.d/mirrorlist sed -i '/.*\.de\/.*/!d' /etc/pacman.d/mirrorlist
# for server dhcpcd and other programs are not required -> see good2know # for server dhcpcd and other programs are not required -> see good2know
pacstrap /mnt base base-devel linux-zen linux-firmware vi dhcpcd wpa_supplicant dialog git netctl curl pacstrap /mnt base base-devel "$KERNEL" linux-firmware vi dhcpcd wpa_supplicant dialog git netctl curl
genfstab -p /mnt > /mnt/etc/fstab genfstab -p /mnt > /mnt/etc/fstab
cat <<EOF > /mnt/root/bootstrap2.sh cat <<EOF > /mnt/root/bootstrap2.sh
@ -145,7 +150,7 @@ locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo $NAME > /etc/hostname echo $NAME > /etc/hostname
mkinitcpio -p linux mkinitcpio -p $KERNEL
pacman -Sy --noconfirm efibootmgr dosfstools gptfdisk pacman -Sy --noconfirm efibootmgr dosfstools gptfdisk
@ -153,15 +158,15 @@ bootctl install
# MAYBE: add intel-ucode images, check for amd # MAYBE: add intel-ucode images, check for amd
cat <<EEE > /boot/loader/entries/arch-uefi.conf cat <<EEE > /boot/loader/entries/arch-uefi.conf
title Arch title Arch
linux /vmlinuz-linux-zen linux /vmlinuz-$KERNEL
initrd /initramfs-linux-zen.img initrd /initramfs-$KERNEL.img
options $KERNEL_OPTIONS options $KERNEL_OPTIONS
EEE EEE
cat <<EEE > /boot/loader/entries/arch-uefi-fallback.conf cat <<EEE > /boot/loader/entries/arch-uefi-fallback.conf
title Arch Linux Fallback title Arch Linux Fallback
linux /vmlinuz-linux-zen linux /vmlinuz-$KERNEL
initrd /initramfs-linux-zen-fallback.img initrd /initramfs-$KERNEL-fallback.img
options $KERNEL_OPTIONS options $KERNEL_OPTIONS
EEE EEE

Loading…
Cancel
Save