This commit is contained in:
Phillip 2024-09-07 21:52:23 +01:00
parent 617a51ccd4
commit a8c610ea7a

View File

@ -22,6 +22,7 @@ esac
# Get user credentials
read -p "Please enter a username " username
read -rsp "Please enter a password " password
echo -ne "\n"
read -rsp "Please re-enter the password " passwordconfirm
if [[ "$password" == "$password2" ]]; then
export USERNAME = $username
@ -29,7 +30,7 @@ if [[ "$password" == "$password2" ]]; then
echo "Credentials saved"
fi
# 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 --noconfirm --needed
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
mkdir /mnt/boot/efi
mount /dev/$efipar /mnt/boot/efi
@ -48,18 +49,8 @@ case $yesno in
esac
# Generate a fstab file
genfstab -U /mnt >> /mnt/etc/fstab
# Copy system config files into the new install
#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
#cp files/sys-mkinitcpio.conf /etc/mkinitcpio.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 setup
arch-chroot /mnt /bin/bash
arch-chroot /mnt /bin/bash <<EOF
sed -i 's/^#en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
pacman -S --noconfirm hunspell-en_gb
@ -75,26 +66,24 @@ pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com
pacman-key --lsign-key 3056513887B78AEB
pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst'
pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'
# Amend pacman.conf
# Amend pacman.conf and run full sync to enable extra repos
sed -i 's/^#Color/Color\nILoveCandy/' /etc/pacman.conf
sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf
echo -e "\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf
# Run full pacman sync to enable extra repos
pacman -Syu
# Enable NetworkManager
systemctl enable NetworkManager
# Install GRUB (this will need to be run again as the standard user in order to detect Windows)
# Install GRUB
echo "Installing bootloader"
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
# Create the standard user and add it to all neccesary groups
# Create the standard user, add it to all neccesary groups and disable the root account
useradd -mG power,storage,wheel $username
echo "$username:$password" | chpasswd
passwd --lock root
# Set up sudo
sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
# Disable the root account
passwd --lock root
# Required to enable network changes
sysctl --system
# Prompt the user to reboot