From 0b1bfa2ef191bd21d5533359badb9be1e4117709 Mon Sep 17 00:00:00 2001 From: Abhas Abhinav Date: Tue, 15 Feb 2022 13:36:35 +0530 Subject: [PATCH] Adds script to flash haiku to the usb disk --- flash-haiku.sh | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 flash-haiku.sh 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"