use docker

This commit is contained in:
Mikaël Cluseau
2024-04-25 20:04:11 +02:00
parent a2fe5d5c82
commit 681fc21714
5 changed files with 34 additions and 54 deletions

View File

@ -9,34 +9,35 @@ if [ -e $out ]; then
fi
# create the file
truncate -s2100M $out
truncate -s144M $out
# partition it
sgdisk \
--new=0:4096:+2G --typecode=0:EF00 -c 0:boot \
--new=0:0:+2M --typecode=0:EF02 -c 0:BIOS-BOOT \
--new=0:4096:+128M --typecode=0:EF00 -c 0:boot \
--new=0:0:+2M --typecode=0:EF02 -c 0:BIOS-BOOT \
--hybrid=1:2 --print $out
dev=$(losetup --find --show --partscan $out)
trap "losetup -d $dev" EXIT
devmap=/tmp/devmap
cat >$devmap <<EOF
(hd0) $dev
EOF
# format filesystems
mkfs.vfat -n BLKBOOT ${dev}p1
# mount
mkdir -p /mnt
(
mount ${dev}p1 /mnt
trap "umount /mnt" EXIT
mkdir -p /boot
mkdir -p /mnt/grub
cp /assets/grub.cfg /mnt/grub
mount ${dev}p1 /boot
trap "umount /boot" EXIT
grub-install --target=i386-pc --boot-directory=/mnt $dev
grub-install --target=x86_64-efi --removable --boot-directory=/mnt --efi-directory=/mnt
)
mkdir -p /boot/grub
cp /assets/grub.cfg /boot/grub
devmap=/boot/grub/device.map
cat >$devmap <<EOF
(hd0) $dev
EOF
grub-install --target=i386-pc $dev
grub-install --target=x86_64-efi --removable --efi-directory=/boot
rm $devmap