fix: Resolving comments on MP

- Adding parition ordering using imagecraft
- Removing redundant locales install
- Better logging for empty ARCH and SUBPROJECT
- Using mktemp for mountpoint
This commit is contained in:
Allen Abraham 2026-03-11 11:40:32 -04:00
parent f45429018c
commit bf2eb46fc8
2 changed files with 21 additions and 22 deletions

View File

@ -18,6 +18,7 @@ volumes:
role: system-boot
filesystem: vfat
size: 4M
partition-number: 14
# 2. EFI System Partition
- name: efi
type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B
@ -25,13 +26,15 @@ volumes:
filesystem-label: UEFI
role: system-boot
size: 106M
partition-number: 15
# 3. Linux Extended Boot
- name: boot
type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
filesystem: ext4
filesystem-label: BOOT
role: system-data
size: 913M
size: 1G
partition-number: 13
# 4. Root Filesystem
- name: rootfs
type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
@ -39,6 +42,7 @@ volumes:
filesystem-label: cloudimg-rootfs
role: system-data
size: 3G
partition-number: 1
filesystems:
default:

View File

@ -7,19 +7,19 @@ SUBPROJECT="${SUBPROJECT:-}"
# We want to start off imagecraft builds with just amd64 support right now
case $ARCH in
amd64)
;;
*)
echo "$ARCH builds for imagecraft is currently not implemented."
exit 0
;;
amd64)
;;
*)
echo "imagecraft build is currently not implemented for ARCH=${ARCH:-unset}."
exit 0
;;
esac
case ${SUBPROJECT} in
minimized)
;;
*)
echo "$SUBPROJECT builds for imagecraft is currently not implemented"
echo "imagecraft build is currently not implemented for SUBPROJECT=${SUBPROJECT:-unset}."
exit 0
;;
esac
@ -27,29 +27,24 @@ esac
_src_d=$(dirname $(readlink -f ${0}))
snap install imagecraft --classic --channel latest/edge
apt install -y qemu-utils parted locales
locale-gen C.UTF-8
export LANG=C.UTF-8
export LC_ALL=C.UTF-8
cp -r "$_src_d"/imagecraft-configs/* .
CRAFT_BUILD_ENVIRONMENT=host imagecraft --verbosity debug pack
# We are using this function instead of mount_disk_image from functions
# because imagecraft doesn't currently support XBOOTLDR's GUID and
# mount_disk_image has an explicit check for the XBOOTLDR GUID
# TODO: Use mount_disk_image once imagecraft supports XBOOTLDR's GUID
mount_image_partitions() {
mount_image "${disk_image}" "$ROOT_PARTITION"
# Making sure that the loop device is ready
partprobe "${loop_device}"
udevadm settle
ls -l "${loop_device}"*
mkdir -p "$mountpoint"
mount_partition "${rootfs_dev_mapper}" "$mountpoint"
mount "${loop_device}p3" "$mountpoint/boot"
mount "${loop_device}p2" "$mountpoint/boot/efi"
mount "${loop_device}p13" "$mountpoint/boot"
mount "${loop_device}p15" "$mountpoint/boot/efi"
}
install_grub_on_image() {
@ -58,7 +53,7 @@ install_grub_on_image() {
chroot "$mountpoint" update-grub
undivert_grub "$mountpoint"
echo "GRUB installed successfully."
echo "GRUB for BIOS boot installed successfully."
}
unmount_image_partitions() {
@ -70,8 +65,8 @@ unmount_image_partitions() {
}
disk_image="pc.img"
ROOT_PARTITION=4
mountpoint="mountpoint"
ROOT_PARTITION=1
mountpoint=$(mktemp -d)
mount_image_partitions