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