LARBS/testing/arch.sh

79 lines
2.4 KiB
Bash
Raw Normal View History

2017-09-25 03:11:10 +02:00
#!/bin/bash
#This is a lazy script I have for auto-installing Arch.
#It's not officially part of LARBS, but I use it for testing.
#DO NOT RUN THIS YOURSELF because Step 1 is it reformatting /dev/sda WITHOUT confirmation,
#which means RIP in peace qq your data unless you've already backed up all of your drive.
2018-11-06 19:53:30 +01:00
pacman -Sy --noconfirm dialog || { echo "Error at script start: Are you sure you're running this as the root user? Are you sure you have an internet connection?"; exit; }
2017-10-05 02:26:34 +02:00
dialog --defaultno --title "DON'T BE A BRAINLET!" --yesno "This is an Arch install script that is very rough around the edges.\n\nOnly run this script if you're a big-brane who doesn't mind deleting your entire /dev/sda drive.\n\nThis script is only really for me so I can autoinstall Arch.\n\nt. Luke" 15 60 || exit
2017-10-05 02:26:34 +02:00
2018-08-01 07:21:21 +02:00
dialog --defaultno --title "DON'T BE A BRAINLET!" --yesno "Do you think I'm meming? Only select yes to DELET your entire /dev/sda and reinstall Arch.\n\nTo stop this script, press no." 10 60 || exit
2017-10-05 02:26:34 +02:00
2017-10-05 09:19:56 +02:00
dialog --no-cancel --inputbox "Enter a name for your computer." 10 60 2> comp
2018-04-08 23:23:34 +02:00
dialog --defaultno --title "Time Zone select" --yesno "Do you want use the default time zone(America/New_York)?.\n\nPress no for select your own time zone" 10 60 && echo "America/New_York" > tz.tmp || tzselect > tz.tmp
2018-01-22 22:20:04 +01:00
dialog --no-cancel --inputbox "Enter partitionsize in gb, separated by space (swap & root)." 10 60 2>psize
IFS=' ' read -ra SIZE <<< $(cat psize)
re='^[0-9]+$'
if ! [ ${#SIZE[@]} -eq 2 ] || ! [[ ${SIZE[0]} =~ $re ]] || ! [[ ${SIZE[1]} =~ $re ]] ; then
SIZE=(12 25);
fi
2017-09-25 03:11:10 +02:00
timedatectl set-ntp true
cat <<EOF | fdisk /dev/sda
o
n
p
+200M
n
p
2018-01-22 22:20:04 +01:00
+${SIZE[0]}G
2017-09-25 03:11:10 +02:00
n
p
2018-01-22 22:20:04 +01:00
+${SIZE[1]}G
2017-09-25 03:11:10 +02:00
n
p
w
EOF
partprobe
2018-08-02 02:25:18 +02:00
yes | mkfs.ext4 /dev/sda4
yes | mkfs.ext4 /dev/sda3
yes | mkfs.ext4 /dev/sda1
2017-09-25 03:11:10 +02:00
mkswap /dev/sda2
swapon /dev/sda2
mount /dev/sda3 /mnt
2018-08-02 02:25:18 +02:00
mkdir -p /mnt/boot
2017-09-25 03:11:10 +02:00
mount /dev/sda1 /mnt/boot
2018-08-02 02:25:18 +02:00
mkdir -p /mnt/home
2017-09-25 03:11:10 +02:00
mount /dev/sda4 /mnt/home
2019-02-02 12:49:50 +01:00
pacman -Sy --noconfirm archlinux-keyring
2017-10-05 09:19:56 +02:00
2017-10-05 03:12:14 +02:00
pacstrap /mnt base base-devel
2017-09-25 03:11:10 +02:00
genfstab -U /mnt >> /mnt/etc/fstab
cat tz.tmp > /mnt/tzfinal.tmp
2018-04-08 23:23:34 +02:00
rm tz.tmp
2018-08-02 02:25:18 +02:00
mv comp /mnt/etc/hostname
2018-08-04 17:48:19 +02:00
curl https://raw.githubusercontent.com/LukeSmithxyz/LARBS/master/testing/chroot.sh > /mnt/chroot.sh && arch-chroot /mnt bash chroot.sh && rm /mnt/chroot.sh
2017-10-06 07:44:26 +02:00
2017-10-05 11:53:46 +02:00
dialog --defaultno --title "Final Qs" --yesno "Reboot computer?" 5 30 && reboot
dialog --defaultno --title "Final Qs" --yesno "Return to chroot environment?" 6 30 && arch-chroot /mnt
clear