arch.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. 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; }
  3. clear
  4. lsblk -d | sed 's/0 disk/0 disk\\n/;s/POINT/POINT\\n/'
  5. read -rp "Press any key to continue"
  6. dialog --no-cancel --inputbox "Enter the drive you want do install Arch Linux for the VIDEOPC on." 10 60 2>drive
  7. DRIVE=$(cat drive)
  8. PVALUE=$(echo "${DRIVE}" | grep "^nvme" | sed 's/.*[0-9]/p/')
  9. cat <<EOF | fdisk -W always /dev/"${DRIVE}"
  10. p
  11. g
  12. n
  13. +1024M
  14. t
  15. 1
  16. n
  17. w
  18. EOF
  19. partprobe
  20. mkfs.vfat -F32 /dev/"${DRIVE}${PVALUE}"1
  21. yes | mkfs.ext4 /dev/"${DRIVE}"2
  22. mount /dev/"${DRIVE}"2 /mnt
  23. pacman -Sy --noconfirm archlinux-keyring
  24. pacstrap /mnt base linux linux-firmware networkmanager rsync grub efibootmgr
  25. genfstab -U /mnt >> /mnt/etc/fstab
  26. mv drive /mnt
  27. echo "Europe/Zurich" > /mnt/tzfinal.tmp
  28. echo "videopc" > /mnt/etc/hostname
  29. cp chroot.sh /mnt
  30. arch-chroot /mnt bash chroot.sh
  31. rm /mnt/chroot.sh
  32. cp videopc-bootstrap.sh /mnt
  33. arch-chroot /mnt bash videopc-bootstrap.sh
  34. rm /mnt/videopc-bootstrap.sh