#! /bin/sh

if [ $# -ne 2 ]; then
    echo "USAGE: $0 <device>"
fi

dev=$1

set -ex

zcat boot.img.gz | dd of=$dev

apk add sgdisk

[[ $dev =~ nvme ]] &&
    devp=${dev}p ||
    devp=${dev}

sgdisk --move-second-header --new=3:0:0 $dev

pvcreate ${devp}3
vgcreate storage ${devp}3

