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.

58 lines
1.8 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 --type plain -d /dev/urandom $device wipe
  10. dd if=/dev/zero of=/dev/mapper/wipe status=progress
  11. cryptsetup 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. cryptsetup luksFormat "$device"2
  21. mkdir /root/.keys
  22. sudo dd if=/dev/urandom of=/root/.keys/swap-keyfile bs=1024 count=4
  23. sudo chmod 600 /root/.keys/swap-keyfile
  24. echo "[INFO]: Re-Enter password for swap encryption"
  25. sudo 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. cryptsetup luksFormat "$device"3
  33. dd bs=512 count=4 if=/dev/random of=/root/.keys/root-keyfile iflag=fullblock
  34. sudo chmod 600 /root/.keys/root-keyfile
  35. echo "[INFO]: Re-Enter password for root encryption"
  36. sudo 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 "$device"1 /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 vim
  45. genfstab -U /mnt/sys >> /mnt/sys/etc/fstab
  46. # Run on chrooted arch install
  47. cp -r ./chroot /mnt/sys/install
  48. cp -r /root/.keys /mnt/sys/root
  49. echo -n "$device" > /mnt/sys/install/device
  50. arch-chroot /mnt/sys /install/install.sh