setup-vm/scripts/1-root-config.sh

55 lines
2.1 KiB
Bash
Raw Normal View History

2024-05-23 16:51:55 +00:00
#!/bin/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'
# Replace pacman.conf with the one installed from the earlier script
mv /etc/pacman.conf.tmp /etc/pacman.conf
# Run full pacman sync
pacman -Syu
# Enable NetworkManager
systemctl enable NetworkManager
# Set up system locale
pacman -S --noconfirm hunspell-en_gb
ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
hwclock --systohc
locale-gen
echo LANG=en_GB.UTF-8 > /etc/locale.conf
echo "KEYMAP=uk" > /etc/vconsole.conf
# Set the hostname of the system
echo archlinux-vm > /etc/hostname
# 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
read -p 'Please type in a username for the standard user account: ' user
useradd -mG power,storage,wheel $user
# Set the password for the standard user
passwd $user
# Amend visudo (See ToDo)
EDITOR=nano visudo
# Disable the root account
passwd --lock root
# Install VM driver
echo "Installing VM drivers"
pacman -S --noconfirm open-vm-tools
cat /proc/version > /etc/arch-release
systemctl enable vmware-vmblock-fuse
systemctl enable vmtoolsd
pacman -S --noconfirm xf86-input-vmmouse xf86-video-vmware mesa
# Required to enable network changes
sysctl --system
# Install essential utilities
pacman -S --noconfirm yay ufw clamav hblock
# Move user script and associated files and change ownership to the new user
mkdir /home/$user/install
cp /buildscripts/2-* /home/$user/install
chown -R $user:$user /home/$user/install
# Prompt the user to reboot
echo "Install complete, please reboot"
# Cleanup: Remove /buildscripts and /userfiles
rm -rf /buildscripts
rm -rf /userfiles