2024-05-23 16:51:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
echo "Building initial system"
|
|
|
|
# Get drive values for installation
|
|
|
|
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 EFI partition: ' efipar
|
2024-06-07 07:52:27 +00:00
|
|
|
# Format the EFI partition to FAT32
|
|
|
|
mkfs.fat -F32 /dev/$efipar
|
2024-05-23 16:51:55 +00:00
|
|
|
# Format the root partition to ext4
|
|
|
|
mkfs.ext4 /dev/$rootpar
|
|
|
|
# Mount root partition
|
|
|
|
mount /dev/$rootpar /mnt
|
|
|
|
# Run pacstrap and install base packages
|
|
|
|
pacstrap -i /mnt base base-devel linux linux-firmware linux-headers git openssh rsync networkmanager grub efibootmgr nano dbus-broker-units mkinitcpio iptables-nft
|
|
|
|
# Create the /boot/efi directory and mount the EFI partition to it
|
|
|
|
mkdir /mnt/boot/efi
|
|
|
|
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
|
|
|
|
# [yesYesYy]* )
|
|
|
|
# mkfs.ext4 /dev/$homepar
|
|
|
|
# ;;
|
|
|
|
# [noNoNn]* )
|
|
|
|
# echo "The home partition will not be wiped"
|
|
|
|
# ;;
|
|
|
|
# * ) echo "Please answer yes (Yes, y, Y) or no (No, n, N)";;
|
|
|
|
# esac
|
|
|
|
# # Mount the home partition
|
|
|
|
# mount /dev/$homepar /mnt/home
|
|
|
|
# Generate a fstab file
|
|
|
|
genfstab -U /mnt >> /mnt/etc/fstab
|
|
|
|
# Copy system config files into the new install
|
|
|
|
cp files/sys-pacman.conf /mnt/etc/pacman.conf.tmp
|
|
|
|
cp files/sys-locale.gen /mnt/etc/locale.gen
|
|
|
|
cp files/sys-environment /mnt/etc/environment
|
|
|
|
cp files/sys-grub /mnt/etc/default/grub
|
|
|
|
cp files/sys-hosts /mnt/etc/hosts
|
|
|
|
cp files/sys-network.conf /etc/sysctl.d/90-network.conf
|
|
|
|
# Create temporary directories to store files for later use
|
|
|
|
mkdir /mnt/buildscripts /mnt/userfiles
|
|
|
|
cp scripts/* /mnt/buildscripts
|
|
|
|
cp files/user-* /mnt/userfiles
|
|
|
|
# Chroot into the new system and run the next script
|
|
|
|
arch-chroot /mnt sh /buildscripts/1-root-config.sh
|