Add mount options

This commit is contained in:
Phillip 2024-09-07 22:06:46 +01:00
parent a8c610ea7a
commit 8308c31fd0

View File

@ -1,4 +1,6 @@
#!/bin/bash
# Set mount options for disks
export MNTOPTIONS ="noatime,compress=zstd,ssd,commit=120";;
echo "We just need to ask some questions before installing"
# Get drive values for installation
lsblk
@ -7,7 +9,7 @@ read -p 'Please enter the drive value for the EFI partition: ' efipar
# Format the root partition to ext4
mkfs.ext4 /dev/$rootpar
# Mount root partition
mount /dev/$rootpar /mnt
mount -o ${MNTOPTIONS},/dev/$rootpar /mnt
# Ask if the EFI partition should be wiped before mounting
read -p "Do you wish to wipe the EFI partition? If you already have an existing OS installed, say No. " yesno
case $yesno in
@ -19,6 +21,18 @@ case $yesno in
;;
* ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";;
esac
# Ask if a home partition should be created
read -p "Do you wish to set a home partition? " yesno
case $yesno in
[yesYesYy]* )
read -p 'Please enter the drive value for the home partition, this partition will be wiped: ' homepar
mkfs.ext4 /dev/$homepar
;;
[noNoNn]* )
echo "A home partition will not be used in this installation"
;;
* ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";;
esac
# Get user credentials
read -p "Please enter a username " username
read -rsp "Please enter a password " password
@ -31,22 +45,12 @@ if [[ "$password" == "$password2" ]]; then
fi
# Run pacstrap and install base packages
pacstrap -i /mnt base base-devel linux linux-firmware rsync networkmanager grub efibootmgr dosfstools os-prober nano dkms dbus-broker-units mkinitcpio iptables-nft --noconfirm --needed
# Create the /boot/efi directory and mount the EFI partition to it
# Create the /boot/efi directory, then mount the EFI partition (and the home partition if selected)
mkdir /mnt/boot/efi
mount /dev/$efipar /mnt/boot/efi
# Ask if a home partition should be created
read -p "Do you wish to set a home partition? " yesno
case $yesno in
[yesYesYy]* )
read -p 'Please enter the drive value for the home partition, this partition will be wiped: ' homepar
mkfs.ext4 /dev/$homepar
mount /dev/$homepar /mnt/home
;;
[noNoNn]* )
echo "A home partition will not be used in this installation"
;;
* ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";;
esac
if test -z "$homepar"; then
mount -o ${MNTOPTIONS},/dev/$homepar /mnt/home
fi
# Generate a fstab file
genfstab -U /mnt >> /mnt/etc/fstab
# Chroot into the new system and setup
@ -59,7 +63,7 @@ hwclock --systohc
echo LANG=en_GB.UTF-8 > /etc/locale.conf
echo "KEYMAP=uk" > /etc/vconsole.conf
echo archlinux > /etc/hostname
echo -e "127.0.0.1 localhost\n::1 localhost\n127.0.0.1 archlinux" >> /etc/hosts
echo -e "\n127.0.0.1 localhost\n::1 localhost\n127.0.0.1 archlinux" >> /etc/hosts
echo -e "\n# Set terminal editor to Nano\nEDITOR=nano" >> /etc/environment
# Add "chaotic-aur" as a Pacman repository
pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com