Update install.sh

This commit is contained in:
proledatarian 2022-02-13 23:48:01 +00:00
parent 08b250784e
commit 825eba3a2b
1 changed files with 20 additions and 20 deletions

View File

@ -20,20 +20,20 @@ echo
IFS=$'\n' IFS=$'\n'
# Set variable containing name and size of all disks. # Set variable containing name and size of all disks.
disks=( $(lsblk -d | tail -n+2 | awk '{print $1" "$4}') ) dsks=( $(lsblk -d | tail -n+2 | awk '{print $1" "$4}') )
# Declare the array. # Declare the array.
declare -a disks declare -a dsks
# Select value on array. # Select value on array.
select disk in ${disks[*]} select dev in ${dsks[*]}
do do
# Separate values by spaces. # Separate values by spaces.
IFS=' ' IFS=' '
# Create new variable of selection. # Create new variable of selection.
array=($disk) array=($dev)
dev="${array[0]}" dev="${array[0]}"
echo echo
@ -47,7 +47,7 @@ sgdisk -Z /dev/$dev &&
echo echo
# Creating boot partition. # Creating boot partition.
size="${array[1]%?}" szmn="${array[1]%?}"
echo "Creating boot partition of 256 MB." echo "Creating boot partition of 256 MB."
sgdisk -n 1:0:+256M /dev/$dev && sgdisk -n 1:0:+256M /dev/$dev &&
echo echo
@ -56,7 +56,7 @@ echo
sgdisk -t 1:ef00 /dev/$dev && sgdisk -t 1:ef00 /dev/$dev &&
# Creating system partition. # Creating system partition.
echo "Creating system partition of $size GB." echo "Creating system partition of $szmn GB."
sgdisk -n 2:0:0 /dev/$dev sgdisk -n 2:0:0 /dev/$dev
echo echo
@ -67,7 +67,7 @@ sleep 1
echo echo
# This needs to be deleted. # This needs to be deleted.
echo $dev > /tmp/disk echo $dev > /tmp/dev
# Exit. # Exit.
break break
@ -75,35 +75,35 @@ done
# This needs to be deleted. # This needs to be deleted.
# Get variable from filesystem. # Get variable from filesystem.
part=$(</tmp/disk)2 main=$(</tmp/dev)2
# Encrypting partition. # Encrypting partition.
echo "Encrypting system partition. This might take a while." echo "Encrypting system partition. This might take a while."
echo echo
cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/$part && cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/$main &&
echo "Partition successfully encrypted." echo "Partition successfully encrypted."
echo echo
# Opening encrypted partition and mounting at /dev/mapper/lvm. # Opening encrypted partition and mounting at /dev/mapper/lvm.
echo "Decrypting.. This also might take a while." echo "Decrypting.. This also might take a while."
echo echo
cryptsetup luksOpen /dev/$part lvm && cryptsetup luksOpen /dev/$main lvm &&
echo "Partition successfully opened." echo "Partition successfully opened."
echo echo
disk="${part%?}" dev="${main%?}"
lsblk | grep "$disk" lsblk | grep "$dev"
echo echo
# Lol, this part: # Lol, this part:
part=$(</tmp/disk)2 && i=( $(lsblk | grep "$part" | tail -n+1 | awk '{print $4}') ) && size="${i%?}" main=$(</tmp/dev)2 && i=( $(lsblk | grep "$main" | tail -n+1 | awk '{print $4}') ) && szmn="${i%?}"
echo "Your system partition has a size of $size GB." echo "Your system partition has a size of $szmn GB."
echo "What size should your root partition have?" echo "What size should your root partition have?"
read root read szrt
echo "Creating a $root GB root volume.." echo "Creating a $szrt GB root volume.."
echo echo
# Ask for everything that is necessary later. # Ask for everything that is necessary later.
@ -141,7 +141,7 @@ echo
echo "Creating logical volumes for root and home." echo "Creating logical volumes for root and home."
echo echo
lvcreate -L ${root}G -n root main && lvcreate -L ${szrt}G -n root main &&
lvcreate -l 100%FREE -n home main && lvcreate -l 100%FREE -n home main &&
echo echo
@ -151,7 +151,7 @@ echo
echo "Creating the filesystem." echo "Creating the filesystem."
echo echo
boot=$(</tmp/disk)1 boot=$(</tmp/dev)1
mkfs.fat -F 32 -n UEFI /dev/$boot && mkfs.fat -F 32 -n UEFI /dev/$boot &&
echo "Filesystem for boot successfully created." echo "Filesystem for boot successfully created."
@ -264,7 +264,7 @@ linux /vmlinuz-linux-zen
initrd /initramfs-linux-zen.img initrd /initramfs-linux-zen.img
# Change to the correct device like /dev/sda2. # Change to the correct device like /dev/sda2.
options cryptdevice=/dev/$part:lvm:allow-discards options cryptdevice=/dev/$main:lvm:allow-discards
# Change to correct LVM device. # Change to correct LVM device.
options root=/dev/mapper/main-root rw options root=/dev/mapper/main-root rw
@ -283,7 +283,7 @@ cat << EOF > /mnt/boot/loader/entries/arch-fallback.conf
title Arch Linux Fallback title Arch Linux Fallback
linux /vmlinuz-linux linux /vmlinuz-linux
initrd /initramfs-linux-fallback.img initrd /initramfs-linux-fallback.img
options cryptdevice=/dev/$part:lvm options cryptdevice=/dev/$main:lvm
options root=/dev/mapper/main-root rw options root=/dev/mapper/main-root rw
options lang=de locale=de_DE.UTF-8 options lang=de locale=de_DE.UTF-8
options init=/usr/lib/systemd/systemd options init=/usr/lib/systemd/systemd