safe-arch.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 -p "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. SIZE=$(cat swapsize)
  16. DRIVE=$(cat drive)
  17. read -p "Press any key to continue"
  18. timedatectl set-ntp true
  19. read -p "Press any key to continue"
  20. cat <<EOF | fdisk -W always /dev/${DRIVE}
  21. p
  22. g
  23. n
  24. +1024M
  25. t
  26. 4
  27. n
  28. +${SIZE}G
  29. t
  30. 2
  31. 19
  32. p
  33. n
  34. t
  35. 3
  36. 20
  37. p
  38. w
  39. EOF
  40. partprobe
  41. read -p "Press any key to continue"
  42. yes | mkfs.ext4 /dev/${DRIVE}3
  43. read -p "Press any key to continue"
  44. mkswap /dev/${DRIVE}2
  45. read -p "Press any key to continue"
  46. swapon /dev/${DRIVE}2
  47. read -p "Press any key to continue"
  48. mount /dev/${DRIVE}3 /mnt
  49. read -p "Press any key to continue"
  50. pacman -Sy --noconfirm archlinux-keyring
  51. read -p "Press any key to continue"
  52. pacstrap /mnt base base-devel linux linux-firmware networkmanager rsync
  53. read -p "Press any key to continue"
  54. genfstab -U /mnt >> /mnt/etc/fstab
  55. read -p "Press any key to continue"
  56. cat tz.tmp > /mnt/tzfinal.tmp
  57. read -p "Press any key to continue"
  58. rm tz.tmp
  59. read -p "Press any key to continue"
  60. mv drive /mnt
  61. read -p "Press any key to continue"
  62. mv comp /mnt/etc/hostname
  63. read -p "Press any key to continue"
  64. curl https://raw.githubusercontent.com/noahvogt/norisa/main/testing/safe-chroot.sh > /mnt/chroot.sh && arch-chroot /mnt bash chroot.sh && rm /mnt/chroot.sh
  65. read -p "Press any key to continue"
  66. dialog --defaultno --title "Final Qs" --yesno "Reboot computer?" 5 30 && reboot
  67. dialog --defaultno --title "Final Qs" --yesno "Return to chroot environment?" 6 30 && arch-chroot /mnt
  68. clear