Skip to content

Instantly share code, notes, and snippets.

@haridhayal11
Last active April 22, 2022 03:26
Show Gist options
  • Save haridhayal11/7be9fbe42eeacbd10b123db9ce4201b4 to your computer and use it in GitHub Desktop.
Save haridhayal11/7be9fbe42eeacbd10b123db9ce4201b4 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Backing up default mirrorlist"
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
echo "Finding Fast mirrors"
reflector --latest 5 --sort rate --save /etc/pacman.d/mirrorlist
sudo pacman -Sy curl
echo "Fetching Secondary Script"
curl -L https://gist.githubusercontent.com/haridhayal11/1f0b2fe1cb31a215f4039d067060828f/raw/d7142b38ec46c557fe01a8ae66234dc8419f5f5c/archer2.sh > archer2.sh
chmod +x archer2.sh
echo "Setting network time"
timedatectl set-ntp true
fdisk -l
read -p "Select the disk to install on (Do not add (/) at the end)[eg: /dev/sdx ] " DRIVE
read -p "All data on $DRIVE will be deleted. Do you want to continue?[y/n]" FORMATCHECK
case $FORMATCHECK in
[Yy]* ) sgdisk --zap-all $DRIVE;;
[Nn]* ) exit;;
* ) echo "Please answer [y/n]";;
esac
read -p "Do you want to setup swap?[y/n]" swap
case $swap in
[Yy]* ) read -p "Enter the size for swap parition [eg: 2GB]" SWAPSIZE
sgdisk --clear \
--new=1:0:+550MiB --typecode=1:ef00 --change-name=1:EFI \
--new=2:0:+$SWAPSIZE --typecode=2:8200 --change-name=2:swap \
--new=3:0:0 --typecode=3:8300 --change-name=3:system \
$DRIVE
BOOTPARTITION=1
SWAPPARTITION=2
ROOTPARTITION=3
mkswap $DRIVE$SWAPPARTITION
swapon $DRIVE$SWAPPARTITION
;;
[Nn]* ) sgdisk --clear \
--new=1:0:+550MiB --typecode=1:ef00 --change-name=1:EFI \
--new=2:0:0 --typecode=2:8300 --change-name=2:system \
$DRIVE
BOOTPARTITION=1
ROOTPARTITION=2
;;
* ) echo "Please answer [y/n]";;
esac
mkfs.fat -F32 $DRIVE$BOOTPARTITION
mkfs.btrfs -f $DRIVE$ROOTPARTITION
mount $DRIVE$ROOTPARTITION /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@var
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@.snapshots
umount /mnt
mount -o noatime,compress=lzo,space_cache,subvol=@ $DRIVE$ROOTPARTITION /mnt
mkdir /mnt/{boot,var,home,.snapshots}
mount -o noatime,compress=lzo,space_cache,subvol=@var $DRIVE$ROOTPARTITION /mnt/var
mount -o noatime,compress=lzo,space_cache,subvol=@home $DRIVE$ROOTPARTITION /mnt/home
mount -o noatime,compress=lzo,space_cache,subvol=@.snapshots $DRIVE$ROOTPARTITION /mnt/.snapshots
mount $DRIVE$BOOTPARTITION /mnt/boot
lsblk
sleep 5
read -p "Select Platform (CPU)
1. Intel
2. AMD
3. VM " PLATFORM
case $PLATFORM in
[1]* ) pacstrap /mnt base linux linux-firmware nano intel-ucode btrfs-progs;;
[2]* ) pacstrap /mnt base linux linux-firmware nano amd-ucode btrfs-progs;;
[3]* ) pacstrap /mnt base linux linux-firmware nano btrfs-progs;;
* ) echo "Please select [1/2/3]";;
esac
genfstab -U /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab
cp archer2.sh /mnt/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment