Added options for formatting EFI partition and if to set a /home partition.

This commit is contained in:
Phillip 2024-09-07 19:52:57 +01:00
parent e833f2a6f0
commit 51d4ea6d67

View File

@ -4,29 +4,39 @@ echo "Building initial system"
lsblk lsblk
read -p 'Please enter the drive value for the root partition, this partition will be wiped and formatted: ' rootpar read -p 'Please enter the drive value for the root partition, this partition will be wiped and formatted: ' rootpar
read -p 'Please enter the drive value for the EFI partition: ' efipar read -p 'Please enter the drive value for the EFI partition: ' efipar
read -p 'Please enter the drive value for the home partition: ' homepar
# Format the root partition to ext4 # Format the root partition to ext4
mkfs.ext4 /dev/$rootpar mkfs.ext4 /dev/$rootpar
# Mount root partition # Mount root partition
mount /dev/$rootpar /mnt mount /dev/$rootpar /mnt
# Run pacstrap and install base packages # Run pacstrap and install base packages
pacstrap -i /mnt base base-devel linux linux-firmware linux-headers intel-ucode git openssh rsync networkmanager grub efibootmgr dosfstools os-prober nano dkms dbus-broker-units mkinitcpio iptables-nft pacstrap -i /mnt base base-devel linux linux-firmware linux-headers intel-ucode git openssh rsync networkmanager grub efibootmgr dosfstools os-prober nano dkms dbus-broker-units mkinitcpio iptables-nft
# Create the /boot/efi directory and mount the EFI partition to it # Ask if the EFI partition should be wiped before mounting
mkdir /mnt/boot/efi read -p "Do you wish to wipe the EFI partition? If you already have an existing OS installed, say No. " yesno
mount /dev/$efipar /mnt/boot/efi
# Ask if the home partition should be wiped before mounting
read -p "Do you wish to wipe the home partition? " yesno
case $yesno in case $yesno in
[yesYesYy]* ) [yesYesYy]* )
mkfs.ext4 /dev/$homepar mkfs.fat -F32 /dev/$efipar
;; ;;
[noNoNn]* ) [noNoNn]* )
echo "The home partition will not be wiped" echo "The EFI partition will not be wiped"
;; ;;
* ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";; * ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";;
esac esac
# Mount the home partition # Create the /boot/efi directory and mount the EFI partition to it
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: ' homepar
mkfs.ext4 /dev/$homepar
mount /dev/$homepar /mnt/home 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
# Generate a fstab file # Generate a fstab file
genfstab -U /mnt >> /mnt/etc/fstab genfstab -U /mnt >> /mnt/etc/fstab
# Copy system config files into the new install # Copy system config files into the new install