The Mostly Harmless USB Disk https://mostlyharmless.io/usb/
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.

74 lines
903 B

  1. #!/bin/bash -v
  2. echo 2>&1
  3. usb=$1
  4. if [ $UID -gt 0 ]
  5. then
  6. echo "Please run as root."
  7. echo "Usage: sudo ./flash-haiku.sh <device>"
  8. exit 1
  9. fi
  10. if [ -z $usb ]
  11. then
  12. echo "Usage: sudo ./flash-haiku.sh <device>"
  13. exit 1
  14. fi
  15. ## Paritition disk
  16. ### Show existing partition table
  17. gdisk -l /dev/$usb
  18. ### Create the new parition for haiku main
  19. echo "
  20. n
  21. 3
  22. +1000M
  23. w
  24. Y
  25. " | gdisk /dev/$usb
  26. #### Run partprobe to refresh partition list
  27. partprobe /dev/$usb
  28. gdisk -l /dev/$usb
  29. sleep 2
  30. #### Create parition for haiku efi
  31. echo "
  32. n
  33. w
  34. Y
  35. " | gdisk /dev/$usb
  36. sleep 2
  37. #### Refresh and print partitions
  38. partprobe /dev/$usb
  39. gdisk -l /dev/$usb
  40. echo; echo;
  41. ## Copy Haiku Main to the 3rd partition
  42. dd if=MH-USB/haiku-main.img of=/dev/"$usb"3 status=progress bs=1M
  43. ## Copy Haiku EFI to the 4th partition
  44. dd if=MH-USB/haiku-boot.img of=/dev/"$usb"4 status=progress bs=1M
  45. echo "Haiku Installed to $usb"