[OLD ARCHIVE] Scripts for full Arch Install
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
ArchScripts/install2.sh

104 lines
3.4 KiB

#!/usr/bin/env bash
lsblk
echo "Specify drive name that you entered in the first script (ex. /dev/sda, /dev/nvme0n1)."
read -r -p "Enter the disk: " DISK
echo "Create a root password (not your user password)."
passwd
echo "Create a user account."
read -r -p "Create username: " Username
useradd -m -g users -G wheel,storage,power -s /bin/bash $Username
echo "Create a USER password (should be different from root)."
passwd $Username
sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
echo "Defaults rootpw" >> /etc/sudoers
sudo pacman -S bash-completion --noconfirm --needed
pacman -S reflector --noconfirm --needed 2>/dev/null || true
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup 2>/dev/null || true
cat > /etc/pacman.d/mirrorlist << 'EOF'
##
## Arch Linux repository mirrorlist
## Generated on install
##
EOF
if reflector -a 48 -c "US" -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist 2>/dev/null; then
sed -i -e '/^\[/d' -e '/^#/!{/^Server/!d}' /etc/pacman.d/mirrorlist
if ! grep -q "^Server" /etc/pacman.d/mirrorlist; then
echo "Warning: reflector produced invalid mirrorlist, restoring backup"
cp /etc/pacman.d/mirrorlist.backup /etc/pacman.d/mirrorlist
sed -i -e '/^\[/d' -e '/^#/!{/^Server/!d}' /etc/pacman.d/mirrorlist
fi
else
echo "Warning: reflector failed, restoring backup mirrorlist"
cp /etc/pacman.d/mirrorlist.backup /etc/pacman.d/mirrorlist
sed -i -e '/^\[/d' -e '/^#/!{/^Server/!d}' /etc/pacman.d/mirrorlist
fi
sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
hwclock --systohc --utc
echo "Set hostname (name of your PC on the network)."
read -r -p "Enter the hostname: " HOSTNAME
echo ${HOSTNAME} > /etc/hostname
systemctl enable fstrim.timer
mount -t efivarfs efivarfs /sys/firmware/efi/efivars/
bootctl install
# Fix boot permissions
chmod 755 /boot
chmod 600 /boot/loader/random-seed 2>/dev/null || true
touch /boot/loader/entries/arch.conf
echo "title Arch" > /boot/loader/entries/arch.conf
echo "linux /vmlinuz-linux" >> /boot/loader/entries/arch.conf
echo "initrd /initramfs-linux.img" >> /boot/loader/entries/arch.conf
echo "options root=PARTUUID=$(blkid -s PARTUUID -o value ${DISK}3) rw" >> /boot/loader/entries/arch.conf
sudo pacman -S networkmanager --noconfirm --needed
sudo pacman -S git --noconfirm --needed
sudo sed -i '/^\#\[multilib\]/s/^#//' /etc/pacman.conf
sudo sed -i '/^\#Include = \/etc\/pacman.d\/mirrorlist/s/^#//' /etc/pacman.conf
sudo pacman -Syu --noconfirm --needed
sudo pacman -S base-devel linux-headers --noconfirm --needed
sudo systemctl enable NetworkManager.service
sudo systemctl start NetworkManager.service
echo "-------------------------------------------------"
echo "Cloning ArchScripts repository"
echo "-------------------------------------------------"
if [ -n "$Username" ]; then
cd /home/$Username
sudo -u $Username git clone https://git.merlinslair.net/beech/ArchScripts.git 2>/dev/null || true
echo "ArchScripts repository cloned to /home/$Username/ArchScripts"
else
echo "Username not set, skipping repo clone"
fi
umount /sys/firmware/efi/efivars/ 2>/dev/null || true
echo "-------------------------------------------------"
echo "Arch Linux Installed & Configured. Please reboot"
echo "-------------------------------------------------"