diff --git a/flash-haiku.sh b/flash-haiku.sh new file mode 100755 index 0000000..321bdc9 --- /dev/null +++ b/flash-haiku.sh @@ -0,0 +1,74 @@ +#!/bin/bash -v + +echo 2>&1 + +usb=$1 + +if [ $UID -gt 0 ] +then + echo "Please run as root." + echo "Usage: sudo ./flash-haiku.sh " + exit 1 +fi + +if [ -z $usb ] +then + echo "Usage: sudo ./flash-haiku.sh " + exit 1 +fi + +## Paritition disk + +### Show existing partition table + +gdisk -l /dev/$usb + +### Create the new parition for haiku main + +echo " +n +3 + ++1000M + +w +Y +" | gdisk /dev/$usb + +#### Run partprobe to refresh partition list + +partprobe /dev/$usb +gdisk -l /dev/$usb + +sleep 2 + +#### Create parition for haiku efi + +echo " +n + + + + +w +Y +" | gdisk /dev/$usb + +sleep 2 + +#### Refresh and print partitions + +partprobe /dev/$usb +gdisk -l /dev/$usb + +echo; echo; + +## Copy Haiku Main to the 3rd partition + +dd if=MH-USB/haiku-main.img of=/dev/"$usb"3 status=progress bs=1M + +## Copy Haiku EFI to the 4th partition + +dd if=MH-USB/haiku-boot.img of=/dev/"$usb"4 status=progress bs=1M + +echo "Haiku Installed to $usb"