Compare commits

...

2 Commits
master ... gpt

Author SHA1 Message Date
Johan Gunnarsson bc613850fa gpt 2024-02-21 20:48:04 +01:00
Johan Gunnarsson a72fb41261 gpt 2024-02-21 20:37:43 +01:00
2 changed files with 4 additions and 2 deletions

View File

@ -9,14 +9,14 @@ set -ex
# >>> (0.95 * 4000000000 // 512) * 512
# 3800000000.0
IMAGE_SIZE=${IMAGE_SIZE:-3800000000}
if [ $IMAGE_SIZE -lt 1000000000 ]; then
if [ "$IMAGE_SIZE" -lt 1000000000 ]; then
echo "IMAGE_SIZE of 1GB or less unsupported!"
exit 1
fi
rm -f "${IMAGE}"
fallocate -v -l "${IMAGE_SIZE}" "${IMAGE}" # 3,800,000,000 bytes
parted -s "${IMAGE}" mklabel msdos
parted -s "${IMAGE}" mklabel gpt
parted -s "${IMAGE}" mkpart primary fat32 -- 4MiB 32MiB # 28 MiB (29,360,128 bytes)
parted -s "${IMAGE}" mkpart primary ext2 -- 32MiB -1
parted -s "${IMAGE}" set 2 boot on

View File

@ -24,6 +24,8 @@ zcat "${BOOT}" "${DEBIAN}" > image.bin
LOOP1=$(losetup -f -P --show image.bin) && {
trap 'losetup -d "${LOOP1}"' ERR
sleep 1
fdisk -l "${LOOP1}"
blkid "${LOOP1}" "${LOOP1}p1" "${LOOP1}p2"
fsck.vfat -p -f "${LOOP1}p1"
fsck.ext4 -p -f "${LOOP1}p2"
trap '-' ERR