summaryrefslogtreecommitdiff
path: root/util/build_disk.sh
blob: 4f049c1315ed766e6b134f20fbaf75ed617ecc55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

set -e

disk=${1:?}
drive=${2:?}
priv=${3:?}

[ -d "$disk" ] || exit 1

truncate -s 512M "$drive"
sfdisk "$drive" <<-EOF
	label: gpt
	type=L
EOF
mkdir -p "$priv"
tar --format=ustar -C "$disk" . -cf "$priv/drive.tar"

dd if="$priv/drive.tar" of="$drive" seek=2048 conv=notrunc