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.

45 lines
1.0 KiB

  1. #!/bin/bash
  2. #
  3. # Arch install script
  4. #
  5. #Define drive params
  6. read -p "Enter driver location: " DRIVE
  7. read -p "Enter swap amount: " DRIVESWAP
  8. #Print all commands
  9. set -x
  10. #Partition drive
  11. parted --script ${DRIVE} "mklabel gpt"
  12. parted --script --align optimal ${DRIVE} "mkpart primary 0% 3MB mkpart primary ext4 3MB -$DRIVESWAP mkpart primary linux-swap -$DRIVESWAP 100%"
  13. parted ${DRIVE} set 1 bios_grub on
  14. #Format drive and mount
  15. mkfs.ext4 ${DRIVE}2
  16. mkswap ${DRIVE}3
  17. mount ${DRIVE}2 /mnt
  18. #Find best mirrors
  19. cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
  20. rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist
  21. #Install base
  22. pacstrap /mnt base
  23. cp /etc/pacman.d/mirrorlist.backup /mnt/etc/pacman.d/
  24. #Build the fs table
  25. genfstab -U /mnt >> /mnt/etc/fstab
  26. #Load chroot configuration script
  27. cp ArchChroot.sh /mnt/
  28. chmod +x /mnt/ArchChroot.sh
  29. if [ -f ArchPost.sh ]; then
  30. cp ArchPost.sh /mnt/
  31. chmod +x /mnt/ArchPost.sh
  32. else
  33. echo "ArchPost.sh does not exist."
  34. fi
  35. arch-chroot /mnt /ArchChroot.sh "$DRIVE"
  36. rm /mnt/ArchChroot.sh
  37. umount /mnt