#!/bin/bash

echo

set -x -e

echo

rm -f ./test.bin || true

echo

dd if=/dev/zero of=./test.bin bs=1000000 count=1024

echo

parted -a optimal -s ./test.bin unit MiB mktable GPT
parted -a optimal -s ./test.bin unit MiB mkpart 1 1 2
parted -a optimal -s ./test.bin set 1 bios_grub on
parted -a optimal -s ./test.bin name 1 BIOS_BOOT_GRUB2
parted -a optimal -s ./test.bin unit MiB mkpart 2 2 $((2+200))
parted -a optimal -s ./test.bin set 2 boot on
parted -a optimal -s ./test.bin name 2 UEFI_SYSTEM
parted -a optimal -s ./test.bin unit MiB mkpart 3 $((2+200)) $((2+200+200))
parted -a optimal -s ./test.bin unit MiB mkpart 4 $((2+200+200)) $((2+200+200+200))
parted -a optimal -s ./test.bin unit MiB mkpart 5 $((2+200+200+200)) $((2+200+200+200+200))
parted -a optimal -s ./test.bin unit MiB mkpart 6 $((2+200+200+200+200)) 100%

echo

parted -s ./test.bin unit MiB print

echo

set +x +e

echo
