parent
829ff06934
commit
a353dcc08f
@ -0,0 +1,85 @@ |
||||
#!/usr/bin/env bash |
||||
# This WILL format and partition 1 drive in your system. It is recommended to run the script with only 1 drive installed. |
||||
# Selected drive is /dev/sda, replace sda with specified drive if you have multiple. List drives with 'lsblk' |
||||
# Change boot, SWAP, and root partition sizes to your needs in lines 15-17 |
||||
|
||||
echo "-------------------------------------------------" |
||||
echo "Arch Install Script 1 - Drive Setup" |
||||
echo "-------------------------------------------------" |
||||
|
||||
echo "Specify drive name for install(ex. /dev/sda, /dev/nvme0n1). THIS WILL FORMAT & PARTITION THE SPECIFIED DRIVE!" |
||||
|
||||
read Diskname |
||||
|
||||
# disk prep |
||||
sgdisk -Z $Diskname # zap all on disk |
||||
sgdisk -a 2048 -o $Diskname # new gpt disk 2048 alignment |
||||
|
||||
# create partitions |
||||
sgdisk -n 1:0:1024M $Diskname # partition 1 (boot) |
||||
sgdisk -n 2:0:4G $Diskname # partition 2 (SWAP - change to desired size) |
||||
sgdisk -n 3:0:35G $Diskname # partition 3 (root - change to desired size) |
||||
sgdisk -n 4:0:0 $Diskname # partition 4 (home, remaining space) |
||||
|
||||
# set partition types |
||||
sgdisk -t 1:ef00 $Diskname |
||||
sgdisk -t 2:8200 $Diskname |
||||
sgdisk -t 3:8300 $Diskname |
||||
sgdisk -t 4:8300 $Diskname |
||||
|
||||
# label partitions |
||||
sgdisk -c 1:"boot" $Diskname |
||||
sgdisk -c 2:"swap" $Diskname |
||||
sgdisk -c 3:"root" $Diskname |
||||
sgdisk -c 4:"home" $Diskname |
||||
|
||||
# make filesystems |
||||
echo "-------------------------------------------------" |
||||
echo "Creating Filesystems" |
||||
echo "-------------------------------------------------" |
||||
|
||||
mkfs.fat -F32 $(Diskname)1 # FAT32 boot partition |
||||
mkswap $(Diskname)2 # create SWAP |
||||
swapon $(Diskname)2 # enable SWAP |
||||
mkfs.ext4 $(Diskname)3 |
||||
mkfs.ext4 $(Diskname)4 |
||||
|
||||
# mount partitions |
||||
echo "-------------------------------------------------" |
||||
echo "Mounting Partitions" |
||||
echo "-------------------------------------------------" |
||||
|
||||
mount $(Diskname)3 /mnt |
||||
mkdir /mnt/boot |
||||
mkdir /mnt/home |
||||
mount $(Diskname)1 /mnt/boot |
||||
mount $(Diskname)4 /mnt/home |
||||
|
||||
# set download mirrors |
||||
echo "-------------------------------------------------" |
||||
echo "Setting Mirrorlist" |
||||
echo "-------------------------------------------------" |
||||
|
||||
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup # backs up mirrorlist |
||||
sudo pacman -Syyy |
||||
sudo pacman -S pacman-contrib --noconfirm |
||||
rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist |
||||
|
||||
# install arch |
||||
echo "-------------------------------------------------" |
||||
echo "Installing to drive" |
||||
echo "-------------------------------------------------" |
||||
|
||||
pacstrap -K /mnt base linux linux-firmware base-devel --noconfirm --needed |
||||
|
||||
echo "-------------------------------------------------" |
||||
echo "Installed - Generating fstab" |
||||
echo "-------------------------------------------------" |
||||
|
||||
# generate fstab |
||||
|
||||
genfstab -U -p /mnt >> /mnt/etc/fstab |
||||
|
||||
echo "-------------------------------------------------" |
||||
echo "Finished install script 1. Please run [arch-chroot /mnt], and move on to the 2nd installer." |
||||
echo "-------------------------------------------------" |
||||
@ -0,0 +1,74 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
# Create your user account following the README instructions before running this. |
||||
# Edit hostname on line 26 if desired |
||||
|
||||
echo "Specify drive name that you entered in the first script." |
||||
|
||||
read Diskname |
||||
|
||||
echo "Create a root password (not your user password)." |
||||
|
||||
passwd |
||||
|
||||
echo "Create user account" |
||||
|
||||
read 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 |
||||
|
||||
# File edits for user permissions |
||||
|
||||
sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers |
||||
echo "Defaults rootpw" >> /etc/sudoers |
||||
|
||||
# generate locales |
||||
|
||||
sudo pacman -S bash-completion --noconfirm --needed |
||||
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 |
||||
|
||||
# set timezone & link HW clock |
||||
|
||||
ln -s /usr/share/zoneinfo/America/Chicago > /etc/localtime |
||||
hwclock --systohc --utc |
||||
|
||||
# set hostname - edit archdesk with preferred hostname |
||||
|
||||
echo archdesk > /etc/hostname |
||||
|
||||
# Enable TRIM |
||||
|
||||
systemctl enable fstrim.timer |
||||
|
||||
# mount efivars |
||||
|
||||
mount -t efivarfs efivarfs /sys/firmware/efi/efivars/ |
||||
|
||||
# install bootloader |
||||
|
||||
bootctl install |
||||
|
||||
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 $(Diskname)3) rw" >> /boot/loader/entries/arch.conf |
||||
|
||||
# install NetworkManager |
||||
|
||||
sudo pacman -S networkmanager --noconfirm --needed |
||||
sudo systemctl enable NetworkManager.service |
||||
|
||||
|
||||
echo "-------------------------------------------------" |
||||
echo "Arch Linux Installed & Configured. Please [exit] & run [umount -R /mnt] and reboot" |
||||
echo "-------------------------------------------------" |
||||
Reference in new issue