Move code from root-config script to install script.

This commit is contained in:
Phillip 2024-09-07 20:58:02 +01:00
parent 78e0b2ce3e
commit 8ff552a06f

View File

@ -49,7 +49,7 @@ 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
cp files/sys-pacman.conf /mnt/etc/pacman.conf.tmp #cp files/sys-pacman.conf /mnt/etc/pacman.conf.tmp
#cp files/sys-locale.gen /mnt/etc/locale.gen #cp files/sys-locale.gen /mnt/etc/locale.gen
cp files/sys-environment /mnt/etc/environment cp files/sys-environment /mnt/etc/environment
cp files/sys-grub /mnt/etc/default/grub cp files/sys-grub /mnt/etc/default/grub
@ -61,7 +61,7 @@ mkdir /mnt/buildscripts /mnt/userfiles
cp scripts/* /mnt/buildscripts cp scripts/* /mnt/buildscripts
cp files/user-* /mnt/userfiles cp files/user-* /mnt/userfiles
# Chroot into the new system, do some setup based on earlier questions and run the next script # Chroot into the new system, do some setup based on earlier questions and run the next script
arch-chroot /mnt /bin/bash <<EOF arch-chroot /mnt /bin/bash
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
@ -70,4 +70,33 @@ hwclock --systohc
echo LANG=en_GB.UTF-8 > /etc/locale.conf echo LANG=en_GB.UTF-8 > /etc/locale.conf
echo "KEYMAP=uk" > /etc/vconsole.conf echo "KEYMAP=uk" > /etc/vconsole.conf
echo archlinux > /etc/hostname echo archlinux > /etc/hostname
sh /buildscripts/1-root-config.sh # Add "chaotic-aur" as a Pacman repository
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
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 "[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)
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
useradd -mG power,storage,wheel $username
echo "$username:$password" | chpasswd
# 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
echo "Install complete, please reboot"
#sh /buildscripts/1-root-config.sh