Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.2 KiB

  1. #!/bin/bash
  2. # Disk setup
  3. echo -n "What is the install device: "
  4. read device
  5. echo "Installing to $device... (Enter to continue)"
  6. read _
  7. # Disk wipe
  8. echo "[INFO]: Wiping disk"
  9. cryptsetup open -q --type plain -d /dev/urandom $device wipe
  10. dd if=/dev/zero of=/dev/mapper/wipe status=progress
  11. cryptsetup -q close wipe
  12. wipefs -a -f $device
  13. # Run cfdisk for manual partitioning
  14. cfdisk $device
  15. # Create the boot partition
  16. echo "[INFO]: Formatting boot partition"
  17. mkfs.fat -F32 "$device"1
  18. # Create the swap partition
  19. echo "[INFO]: Enter password for swap encryption"
  20. read swap_pass
  21. echo $swap_pass | cryptsetup -q luksFormat "$device"2
  22. mkdir /root/.keys
  23. dd if=/dev/urandom of=/root/.keys/swap-keyfile bs=1024 count=4
  24. chmod 600 /root/.keys/swap-keyfile
  25. echo $swap_pass | cryptsetup luksAddKey "$device"2 /root/.keys/swap-keyfile
  26. echo "[INFO]: Keyfile saved to /root/.keys/swap-keyfile"
  27. cryptsetup open --key-file="/root/.keys/swap-keyfile" "$device"2 swap
  28. mkswap /dev/mapper/swap
  29. swapon /dev/mapper/swap
  30. # Create the root partition
  31. echo "[INFO]: Enter password for root encryption"
  32. read root_pass
  33. echo $root_pass | cryptsetup -q luksFormat "$device"3
  34. dd bs=512 count=4 if=/dev/random of=/root/.keys/root-keyfile iflag=fullblock
  35. chmod 600 /root/.keys/root-keyfile
  36. echo $root_pass | cryptsetup luksAddKey "$device"3 /root/.keys/root-keyfile
  37. echo "[INFO]: Keyfile saved to /root/.keys/root-keyfile"
  38. cryptsetup open --key-file="/root/.keys/root-keyfile" "$device"3 root
  39. mkfs.ext4 /dev/mapper/root
  40. mkdir /mnt/sys
  41. mount /dev/mapper/root /mnt/sys
  42. mkdir /mnt/sys/boot
  43. mount "$device"1 /mnt/sys/boot
  44. pacstrap /mnt/sys base linux linux-firmware base-devel git nano
  45. genfstab -U /mnt/sys >> /mnt/sys/etc/fstab
  46. # Run on chrooted arch install
  47. mkdir /mnt/sys/install
  48. cp -r /root/.keys /mnt/sys/root
  49. curl https://raw.githubusercontent.com/theFr1nge/dotfiles/main/arch-setup/AUR.txt > /mnt/sys/install/AUR.txt
  50. curl https://raw.githubusercontent.com/theFr1nge/dotfiles/main/arch-setup/nonAUR.txt > /mnt/sys/install/nonAUR.txt
  51. curl https://raw.githubusercontent.com/theFr1nge/dotfiles/main/arch-setup/chroot.sh > /mnt/sys/install/chroot.sh
  52. chmod +x /mnt/sys/install/chroot.sh
  53. echo -n "$device" > /mnt/sys/install/device
  54. arch-chroot /mnt/sys /install/chroot.sh