diff options
| author | Chris Titus <[email protected]> | 2021-10-21 15:23:20 -0500 |
|---|---|---|
| committer | Chris Titus <[email protected]> | 2021-10-21 15:23:20 -0500 |
| commit | 42a02fc81679ac1f678dbcb8c73f36b9a5b8bcad (patch) | |
| tree | c8812d3b375105d6f7967fa0ffa2256bbc7eaa6f /0-preinstall.sh | |
| download | ArchTitus-42a02fc81679ac1f678dbcb8c73f36b9a5b8bcad.tar.xz ArchTitus-42a02fc81679ac1f678dbcb8c73f36b9a5b8bcad.zip | |
1.0 Launch
Diffstat (limited to '0-preinstall.sh')
| -rwxr-xr-x | 0-preinstall.sh | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/0-preinstall.sh b/0-preinstall.sh new file mode 100755 index 0000000..c687d9b --- /dev/null +++ b/0-preinstall.sh @@ -0,0 +1,104 @@ +#!/usr/bin/env bash +#------------------------------------------------------------------------- +# █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗ +# ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝ +# ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗ +# ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║ +# ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║ +# ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ +#------------------------------------------------------------------------- + +echo "-------------------------------------------------" +echo "Setting up mirrors for optimal download " +echo "-------------------------------------------------" +iso=$(curl -4 ifconfig.co/country-iso) +timedatectl set-ntp true +pacman -S --noconfirm pacman-contrib terminus-font +setfont ter-v22b +pacman -S --noconfirm reflector rsync +mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup +echo -e "-------------------------------------------------------------------------" +echo -e " █████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗" +echo -e " ██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝" +echo -e " ███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗" +echo -e " ██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║" +echo -e " ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║" +echo -e " ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝" +echo -e "-------------------------------------------------------------------------" +reflector -a 48 -c $iso -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist +mkdir /mnt + + +echo -e "\nInstalling prereqs...\n$HR" +pacman -S --noconfirm gptfdisk btrfs-progs + +echo "-------------------------------------------------" +echo "-------select your disk to format----------------" +echo "-------------------------------------------------" +lsblk +echo "Please enter disk to work on: (example /dev/sda)" +read DISK +echo "THIS WILL FORMAT AND DELETE ALL DATA ON THE DISK" +read -p "are you sure you want to continue (Y/N):" formatdisk +case $formatdisk in + +y|Y|yes|Yes|YES) +echo "--------------------------------------" +echo -e "\nFormatting disk...\n$HR" +echo "--------------------------------------" + +# disk prep +sgdisk -Z ${DISK} # zap all on disk +sgdisk -a 2048 -o ${DISK} # new gpt disk 2048 alignment + +# create partitions +sgdisk -n 1:0:+1000M ${DISK} # partition 1 (UEFI SYS), default start block, 512MB +sgdisk -n 2:0:0 ${DISK} # partition 2 (Root), default start, remaining + +# set partition types +sgdisk -t 1:ef00 ${DISK} +sgdisk -t 2:8300 ${DISK} + +# label partitions +sgdisk -c 1:"UEFISYS" ${DISK} +sgdisk -c 2:"ROOT" ${DISK} + +# make filesystems +echo -e "\nCreating Filesystems...\n$HR" + +mkfs.vfat -F32 -n "UEFISYS" "${DISK}1" +mkfs.btrfs -L "ROOT" "${DISK}2" +mount -t btrfs "${DISK}2" /mnt +btrfs subvolume create /mnt/@ +umount /mnt +;; +esac + +# mount target +mount -t btrfs -o subvol=@ "${DISK}2" /mnt +mkdir /mnt/boot +mkdir /mnt/boot/efi +mount -t vfat "${DISK}1" /mnt/boot/ + +echo "--------------------------------------" +echo "-- Arch Install on Main Drive --" +echo "--------------------------------------" +pacstrap /mnt base base-devel linux linux-firmware vim nano sudo archlinux-keyring wget libnewt --noconfirm --needed +genfstab -U /mnt >> /mnt/etc/fstab +echo "keyserver hkp://keyserver.ubuntu.com" >> /mnt/etc/pacman.d/gnupg/gpg.conf +echo "--------------------------------------" +echo "-- Bootloader Systemd Installation --" +echo "--------------------------------------" +bootctl install --esp-path=/mnt/boot +[ ! -d "/mnt/boot/loader/entries" ] && mkdir -p /mnt/boot/loader/entries +cat <<EOF > /mnt/boot/loader/entries/arch.conf +title Arch Linux +linux /vmlinuz-linux +initrd /initramfs-linux.img +options root=${DISK}2 rw rootflags=subvol=@ +EOF +cp -R ~/ArchTitus /mnt/root/ +cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist +echo "--------------------------------------" +echo "-- SYSTEM READY FOR 0-setup --" +echo "--------------------------------------" |
