summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rwxr-xr-xutil/build_disk.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/util/build_disk.sh b/util/build_disk.sh
new file mode 100755
index 0000000..4f049c1
--- /dev/null
+++ b/util/build_disk.sh
@@ -0,0 +1,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