commit:     755179ce97fa6eda50c73cb59914ce428cbfaa6c
Author:     Nowa Ammerlaan <nowa <AT> gentoo <DOT> org>
AuthorDate: Mon May  5 15:40:12 2025 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct  3 14:22:16 2025 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=755179ce

create-iso.sh: add support for creating an extra partition

- second argument (if specified) will control the size of this
partition.

- We give the partition the GUID of a generic Linux data partition,
when translated to MBR this also maps to a Linux partition
automatically.

- The arguments we are adding are options for xorriso, not for
grub-mkrescue. Grub-mkrescue passes on whatever we give it extra.

- XFS is hardcoded for now, we can extend this in the future,
possibly by adding support for a third argument.

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
Signed-off-by: Nowa Ammerlaan <nowa <AT> gentoo.org>

 targets/support/create-iso.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index aa597a59..c0e682f4 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -199,6 +199,24 @@ case ${clst_hostarch} in
                sparc*) extra_opts+=("--sparc-boot") ;;
                esac
 
+               # Second argument will specify size in kilobytes
+               if [[ ${2} =~ ^[0-9]+$ ]]; then
+                       extrapart=${1%.*}-extra.img
+                       rm -f "${extrapart}"
+                       dd if=/dev/zero of="${extrapart}" bs=1k count="${2}"
+                       # TODO: allow setting different fs type
+                       mkfs.xfs "${extrapart}"
+                       # 1=ESP, 2=HFS+, so 3 is first available partition
+                       extra_opts+=(
+                               "-append_partition"
+                               "3"
+                               "0FC63DAF-8483-4772-8E79-3D69D8477DE4"
+                               "${extrapart}"
+                       )
+               elif [[ -n ${2} ]]; then
+                       die "Invalid second argument, must be an integer"
+               fi
+
                echo ">> Running grub-mkrescue to create iso image...."
                grub-mkrescue --mbr-force-bootable -volid 
"${clst_iso_volume_id}" "${extra_opts[@]}" -o "${1}" "${clst_target_path}"
        ;;

Reply via email to