arch.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. # This a lazy and DANGEROUS way to install Arch.
  3. # I do not recommend this to other people, ONLY
  4. # do this if you exactly understand EVERY SINGLE
  5. # LINE of this bash script. You'll thank me later.
  6. pacman -Sy --noconfirm dialog || { printf "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"; exit; }
  7. dialog --defaultno --title "WARNING!" --yesno "Do only run this script if you're a big brain who doesn't mind deleting one or more (this depends on your level of stupidity in the following steps) of his /dev/sd[x] drives. \n\nThis script is only really for me so I can save some of my precious time.\n\nNoah" 15 60 || { clear; exit; }
  8. dialog --no-cancel --inputbox "Enter the hostname." 10 60 2>comp
  9. clear
  10. lsblk -d | sed 's/0 disk/0 disk\\n/;s/POINT/POINT\\n/'
  11. read -rp "Press any key to continue"
  12. dialog --no-cancel --inputbox "Enter the drive you want do install Arch on." 10 60 2>drive
  13. dialog --defaultno --title "Time Zone select" --yesno "Do you want use the default time zone(Europe/Zurich)?.\n\nPress no for select your own time zone" 10 60 && echo "Europe/Zurich" > tz.tmp || tzselect > tz.tmp
  14. dialog --no-cancel --inputbox "Enter swapsize in gb (only type in numbers)." 10 60 2>swapsize
  15. ls /sys/firmware/efi/efivars && EFI=yes
  16. SIZE=$(cat swapsize)
  17. DRIVE=$(cat drive)
  18. PVALUE=$(echo "${DRIVE}" | grep "^nvme" | sed 's/.*[0-9]/p/')
  19. timedatectl set-ntp true
  20. if [ "$EFI" = "yes" ]; then
  21. UEFI_LETTER="1"
  22. SWAP_LETTER="2"
  23. ROOT_LETTER="3"
  24. cat <<EOF | fdisk -W always /dev/"${DRIVE}"
  25. g
  26. n
  27. p
  28. +1024M
  29. t
  30. 1
  31. n
  32. p
  33. +${SIZE}G
  34. t
  35. 2
  36. 19
  37. n
  38. w
  39. EOF
  40. mkfs.vfat -F32 /dev/"${DRIVE}${PVALUE}${UEFI_LETTER}"
  41. else
  42. cat <<EOF | fdisk -W always /dev/"${DRIVE}"
  43. SWAP_LETTER="1"
  44. ROOT_LETTER="2"
  45. o
  46. n
  47. p
  48. +${SIZE}G
  49. t
  50. 82
  51. n
  52. p
  53. a
  54. 2
  55. w
  56. EOF
  57. fi
  58. partprobe
  59. while true; do
  60. cryptsetup luksFormat --type luks1 /dev/"${DRIVE}${PVALUE}${ROOT_LETTER}" &&
  61. break
  62. done
  63. while true; do
  64. cryptsetup open /dev/"${DRIVE}${PVALUE}${ROOT_LETTER}" cryptroot && break
  65. done
  66. yes | mkfs.ext4 /dev/mapper/cryptroot
  67. mount /dev/mapper/cryptroot /mnt
  68. pacman -Sy --noconfirm archlinux-keyring
  69. pacstrap /mnt base linux linux-firmware cryptsetup
  70. genfstab -U /mnt >> /mnt/etc/fstab
  71. cat tz.tmp > /mnt/tzfinal.tmp
  72. rm tz.tmp
  73. mv drive /mnt
  74. mv comp /mnt/etc/hostname
  75. curl -LO noahvogt.com/chroot.sh --output-dir /mnt && arch-chroot /mnt bash chroot.sh && rm /mnt/chroot.sh
  76. curl -LO noahvogt.com/norisa.sh --output-dir /mnt && dialog --defaultno --title "NoRiSA" --yesno "Launch NoRiSA install script?" 6 30 && arch-chroot /mnt bash norisa.sh && rm /mnt/norisa.sh
  77. dialog --defaultno --title "Final Qs" --yesno "Return to chroot environment?" 6 30 && arch-chroot /mnt
  78. clear