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 # Get user credentials
read -p "Please enter a username " username read -p "Please enter a username " username
read -rsp "Please enter a password " password read -rsp "Please enter a password " password
echo -ne "\n"
read -rsp "Please re-enter the password " passwordconfirm read -rsp "Please re-enter the password " passwordconfirm
if [[ "$password" == "$password2" ]]; then if [[ "$password" == "$password2" ]]; then
export USERNAME = $username export USERNAME = $username
@ -29,7 +30,7 @@ if [[ "$password" == "$password2" ]]; then
echo "Credentials saved" echo "Credentials saved"
fi fi
# 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 --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 # Create the /boot/efi directory and mount the EFI partition to it
mkdir /mnt/boot/efi mkdir /mnt/boot/efi
mount /dev/$efipar /mnt/boot/efi mount /dev/$efipar /mnt/boot/efi
@ -48,18 +49,8 @@ case $yesno in
esac 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
#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 # 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 sed -i 's/^#en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen
locale-gen locale-gen
pacman -S --noconfirm hunspell-en_gb 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-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-keyring.pkg.tar.zst'
pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.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/^#Color/Color\nILoveCandy/' /etc/pacman.conf
sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
sed -i "/\[multilib\]/,/Include/"'s/^#//' /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 echo -e "\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf
# Run full pacman sync to enable extra repos
pacman -Syu pacman -Syu
# Enable NetworkManager # Enable NetworkManager
systemctl 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" echo "Installing bootloader"
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg 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 useradd -mG power,storage,wheel $username
echo "$username:$password" | chpasswd echo "$username:$password" | chpasswd
passwd --lock root
# Set up sudo # Set up sudo
sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers 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 # Required to enable network changes
sysctl --system sysctl --system
# Prompt the user to reboot # Prompt the user to reboot