stage1.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. error_exit() {
  3. echo "$1"
  4. exit 1
  5. }
  6. pacman -Sy --noconfirm dialog || error_exit "Error at script start:\n\nAre you sure you're running this as the root user?\n\t(Tip: run 'whoami' to check)\n\nAre you sure you have an internet connection?\n\t(Tip: run 'ip a' to check)\n"
  7. clear
  8. lsblk -d | sed 's/0 disk/0 disk\\n/;s/POINT/POINT\\n/'
  9. read -rp "Press any key to continue"
  10. dialog --no-cancel --inputbox "Enter the drive you want do install Arch Linux for the VIDEOPC on." 10 60 2>drive
  11. test -d /sys/firmware/efi/efivars || error_exit "Error: Please boot in UEFI mode. No efi vars detected."
  12. DRIVE=$(cat drive)
  13. cat <<EOF | fdisk -W always /dev/"${DRIVE}"
  14. g
  15. n
  16. p
  17. +1024M
  18. t
  19. 1
  20. n
  21. p
  22. p
  23. w
  24. EOF
  25. partprobe
  26. mkfs.fat -F32 /dev/"$DRIVE"1
  27. while true; do
  28. cryptsetup luksFormat --type luks2 /dev/"$DRIVE"2 && break
  29. done
  30. while true; do
  31. cryptsetup open /dev/"$DRIVE"2 cryptroot && break
  32. done
  33. yes | mkfs.ext4 /dev/mapper/cryptroot
  34. mount /dev/mapper/cryptroot /mnt
  35. mkdir -p /mnt/efi
  36. mount /dev/"$DRIVE"1 /mnt/efi
  37. pacman -Sy --noconfirm archlinux-keyring
  38. pacstrap /mnt base linux networkmanager sbctl amd-ucode efibootmgr cryptsetup tpm2-tss
  39. genfstab -U /mnt >> /mnt/etc/fstab
  40. mv drive /mnt
  41. echo "videopc" > /mnt/etc/hostname
  42. cp chroot.sh /mnt
  43. arch-chroot /mnt bash chroot.sh
  44. rm /mnt/chroot.sh
  45. cp stage2.sh /mnt