arch.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. PVALUE=$(echo "${DRIVE}" | grep "^nvme" | sed 's/.*[0-9]/p/')
  14. cat <<EOF | fdisk -W always /dev/"${DRIVE}"
  15. g
  16. n
  17. p
  18. +1024M
  19. t
  20. 1
  21. n
  22. p
  23. p
  24. w
  25. EOF
  26. partprobe
  27. mkfs.fat -F32 /dev/"${DRIVE}${PVALUE}"1
  28. yes | mkfs.ext4 /dev/"${DRIVE}${PVALUE}"2
  29. mount /dev/"${DRIVE}${PVALUE}"2 /mnt
  30. mkdir -p /mnt/efi
  31. mount /dev/"$DRIVE$PVALUE"1 /mnt/efi
  32. pacman -Sy --noconfirm archlinux-keyring
  33. pacstrap /mnt base linux networkmanager sbctl amd-ucode efibootmgr
  34. genfstab -U /mnt >> /mnt/etc/fstab
  35. mv drive /mnt
  36. echo "videopc" > /mnt/etc/hostname
  37. cp chroot.sh /mnt
  38. arch-chroot /mnt bash chroot.sh
  39. rm /mnt/chroot.sh
  40. exit
  41. cp videopc-bootstrap.sh /mnt
  42. arch-chroot /mnt bash videopc-bootstrap.sh
  43. rm /mnt/videopc-bootstrap.sh