Last active
June 6, 2023 15:30
-
-
Save septicwolf818/0e0d754a4cd30de6e7b6f5bc66d339fa to your computer and use it in GitHub Desktop.
Arch Linux install script (X SERVER/NVIDIA GPU/GNOME 3)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ask if Wi-Fi is needed | |
read -p "Do you need to connect to a Wi-Fi network? (y/n): " need_wifi | |
if [[ "$need_wifi" =~ [yY](es)* ]]; then | |
wifi-menu | |
fi | |
# Ask for hostname, username, and password | |
read -p "Enter the hostname for the new system: " hostname | |
read -p "Enter the username for the new system: " username | |
read -s -p "Enter the password for the new user: " password | |
echo | |
echo "We need 2 MBR|DOS partitions. One for swap and second one for root (/) - make sure you have created 2 partitions." | |
# Ask if partitioning is done | |
read -p "Has the partitioning already been done? (y/n): " is_partitioned | |
if [[ "$is_partitioned" =~ [nN](o)* ]]; then | |
# Ask if cfdisk should be used for partitioning | |
read -p "Do you want to use cfdisk to partition your disks? (y/n): " use_cfdisk | |
if [[ "$use_cfdisk" =~ [yY](es)* ]]; then | |
cfdisk | |
else | |
echo "Please partition your disks manually and re-run the script." | |
exit | |
fi | |
fi | |
# Ask for partition information | |
read -p "Enter the swap partition (e.g. /dev/sda1): " swap_partition | |
read -p "Enter the root partition (e.g. /dev/sda2): " root_partition | |
# Format the partitions | |
mkfs.ext4 $root_partition | |
mkswap $swap_partition | |
swapon $swap_partition | |
# Mount the partitions | |
mount $root_partition /mnt | |
# Save partition mounts in fstab | |
genfstab -U /mnt >> /mnt/etc/fstab | |
# Install essential packages and GNOME 3 | |
pacstrap /mnt base base-devel linux linux-firmware xorg-server xorg-apps xorg-xinit nvidia nvidia-utils gnome gdm networkmanager network-manager-applet alsa-utils python jdk17-openjdk openjdk17-doc tree git firefox thunderbird neofetch file-roller gnome-boxes gnome-connections gnome-dictionary gnome-notes gnome-sound-recorder gnome-terminal gnome-tweaks gnome-calendar simple-scan | |
# Configure the system | |
arch-chroot /mnt /bin/bash -c "echo $hostname > /etc/hostname; \ | |
tree /usr/share/zoneinfo/* | less; \ | |
read -p 'Enter the appropriate time zone: ' timezone; \ | |
ln -sf /usr/share/zoneinfo/$timezone /etc/localtime; \ | |
hwclock --systohc; \ | |
echo 'pl_PL.UTF-8 UTF-8' > /etc/locale.gen; \ | |
locale-gen; \ | |
echo 'LANG=pl_PL.UTF-8' > /etc/locale.conf; \ | |
echo 'KEYMAP=pl' > /etc/vconsole.conf; \ | |
echo 'FONT=Lat2-Terminus16' >> /etc/vconsole.conf; \ | |
echo 'root:$password' | chpasswd; \ | |
useradd -m -G wheel $username; \ | |
echo '$username:$password' | chpasswd; \ | |
echo '%wheel ALL=(ALL) ALL' >> /etc/sudoers; \ | |
systemctl enable NetworkManager.service; \ | |
systemctl enable gdm.service" | |
# Ask for the drive to install GRUB | |
lsblk | |
read -p "Enter the drive to install GRUB (e.g. /dev/sda): " drive | |
# Install GRUB | |
arch-chroot /mnt /bin/bash -c "pacman -S grub; \ | |
grub-install --target=i386-pc $drive; \ | |
grub-mkconfig -o /boot/grub/grub.cfg" | |
# Unmount the partitions | |
umount -R /mnt | |
# Reboot the system | |
reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment