public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-08-09 19:34 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     6e3cb65fdfedc2bdd2c1ddf4cd60fcdc38168760
Author:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
AuthorDate: Mon May 13 15:06:42 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon May 13 15:06:42 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=6e3cb65f

bootloader_setup.sh: fix LABEL for cached entry as well

Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 targets/support/bootloader-setup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh
index 9196ea14..2f2f97a5 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -132,7 +132,7 @@ case ${clst_hostarch} in
 			echo "menuentry 'Boot LiveCD (kernel: ${x}) (cached)' --class gnu-linux --class os {"  >> ${iacfg}
 			if [ ${distkernel} = "yes" ]
 			then
-				echo "	search --no-floppy --set=root -l 'ISOIMAGE'" >> ${iacfg}
+				echo "	search --no-floppy --set=root -l ${clst_iso_volume_id}" >> ${iacfg}
 				echo "	linux ${kern_subdir}/${x} ${default_dracut_append_line[@]} rd.live.ram=1" >> ${iacfg}
 			else
 				echo "	linux ${kern_subdir}/${x} ${default_append_line[@]} docache" >> ${iacfg}


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-08-09 19:34 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     57b03421626a9cdd159075b40974cc3b401e3742
Author:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
AuthorDate: Mon May 13 15:24:24 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon May 13 15:24:24 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=57b03421

bootloader_setup.sh: pass cdroot for dist-kernels as well

This is actually used in livecd-tools later, independent of gk vs dracut

Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 targets/support/bootloader-setup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh
index 2f2f97a5..b82e092c 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -54,7 +54,7 @@ memtest_grub() {
 }
 
 default_append_line=(${cmdline_opts[@]} cdroot)
-default_dracut_append_line=(root=live:CDLABEL=${clst_iso_volume_id} rd.live.dir=/ rd.live.squashimg=image.squashfs)
+default_dracut_append_line=(root=live:CDLABEL=${clst_iso_volume_id} rd.live.dir=/ rd.live.squashimg=image.squashfs cdroot)
 
 case ${clst_hostarch} in
 	alpha)


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-08-09 19:34 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     e41fa2eba386fd39942f5235438d550f5ddef4dc
Author:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
AuthorDate: Tue May 14 13:25:20 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May 14 13:25:20 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=e41fa2eb

bootloader-setup.sh: apply livecd/bootargs to dist-kernel as well

Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 targets/support/bootloader-setup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh
index b82e092c..34d95dc9 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -54,7 +54,7 @@ memtest_grub() {
 }
 
 default_append_line=(${cmdline_opts[@]} cdroot)
-default_dracut_append_line=(root=live:CDLABEL=${clst_iso_volume_id} rd.live.dir=/ rd.live.squashimg=image.squashfs cdroot)
+default_dracut_append_line=(${clst_livecd_bootargs} root=live:CDLABEL=${clst_iso_volume_id} rd.live.dir=/ rd.live.squashimg=image.squashfs cdroot)
 
 case ${clst_hostarch} in
 	alpha)


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-08-09 19:34 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     5f91f18939b076949bffbfbacd921efc07109c1c
Author:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  7 11:05:55 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Jun  7 11:07:23 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=5f91f189

create-iso.sh: add flag for BIOS boot quirk

Some BIOS implementations (or legacy CSM/compat on UEFI) may ignore a
boot device if it doesn't have one MBR partition marked with the boot
flag.  This new argument to xorriso will add an extra dummy partition
with that flag.  It's been reported to help at least one user boot.

Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 targets/support/create-iso.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index 0468f965..aa597a59 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -200,7 +200,7 @@ case ${clst_hostarch} in
 		esac
 
 		echo ">> Running grub-mkrescue to create iso image...."
-		grub-mkrescue -volid "${clst_iso_volume_id}" "${extra_opts[@]}" -o "${1}" "${clst_target_path}"
+		grub-mkrescue --mbr-force-bootable -volid "${clst_iso_volume_id}" "${extra_opts[@]}" -o "${1}" "${clst_target_path}"
 	;;
 esac
 exit  $?


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-09-27 23:04 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-09-27 23:04 UTC (permalink / raw
  To: gentoo-commits

commit:     4f9b89c7e7e0de6f3a0dbc5cc45f7bd862cbe80c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 27 23:03:39 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 27 23:03:39 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=4f9b89c7

Copy create-iso to create-qcow2

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

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

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
new file mode 100755
index 00000000..aa597a59
--- /dev/null
+++ b/targets/support/create-qcow2.sh
@@ -0,0 +1,206 @@
+#!/bin/bash
+
+source ${clst_shdir}/support/functions.sh
+
+## START RUNSCRIPT
+
+# Check for our CD ISO creation tools
+case ${clst_hostarch} in
+	alpha)
+		cdmaker="xorriso"
+		cdmakerpkg="dev-libs/libisoburn"
+		;;
+	mips)
+		cdmaker="sgibootcd"
+		cdmakerpkg="sys-boot/sgibootcd"
+		;;
+	ppc*|powerpc*|sparc*)
+		cdmaker="grub-mkrescue"
+		cdmakerpkg="dev-libs/libisoburn and sys-boot/grub:2"
+		;;
+	amd64|arm64|ia64|x86|i?86)
+		cdmaker="grub-mkrescue"
+		# grub-mkrescue requires:
+		#  xorriso from libisoburn
+		#  mkisofs from cdrtools
+		#  mformat from mtools
+		cdmakerpkg="sys-fs/mtools, dev-libs/libisoburn, sys-boot/grub:2, and app-cdr/cdrtools"
+		;;
+	*)
+		cdmaker="mkisofs"
+		cdmakerpkg="app-cdr/cdrtools"
+		;;
+esac
+
+[ ! -f /usr/bin/${cdmaker} ] \
+   && echo && echo && die \
+   "!!! /usr/bin/${cdmaker} is not found.  Have you merged ${cdmakerpkg}?" \
+   && echo && echo
+
+# If not volume ID is set, make up a sensible default
+if [ -z "${clst_iso_volume_id}" ]
+then
+	case ${clst_livecd_type} in
+		gentoo-*)
+			case ${clst_hostarch} in
+				alpha)
+					clst_iso_volume_id="Gentoo Linux - Alpha"
+				;;
+				amd64)
+					clst_iso_volume_id="Gentoo Linux - AMD64"
+				;;
+				arm)
+					clst_iso_volume_id="Gentoo Linux - ARM"
+				;;
+				arm64)
+					clst_iso_volume_id="Gentoo Linux - ARM64"
+				;;
+				hppa)
+					clst_iso_volume_id="Gentoo Linux - HPPA"
+				;;
+				ia64)
+					clst_iso_volume_id="Gentoo Linux - IA64"
+				;;
+				m68k)
+					clst_iso_volume_id="Gentoo Linux - M68K"
+				;;
+				mips)
+					clst_iso_volume_id="Gentoo Linux - MIPS"
+				;;
+				ppc*|powerpc*)
+					clst_iso_volume_id="Gentoo Linux - PowerPC"
+				;;
+				s390)
+					clst_iso_volume_id="Gentoo Linux - S390"
+				;;
+				sh)
+					clst_iso_volume_id="Gentoo Linux - SH"
+				;;
+				sparc*)
+					clst_iso_volume_id="Gentoo Linux - SPARC"
+				;;
+				x86)
+					clst_iso_volume_id="Gentoo Linux - x86"
+				;;
+				*)
+					clst_iso_volume_id="Catalyst LiveCD"
+				;;
+				esac
+	esac
+fi
+
+if [ "${#clst_iso_volume_id}" -gt 32 ]; then
+	old_clst_iso_volume_id=${clst_iso_volume_id}
+	clst_iso_volume_id="${clst_iso_volume_id:0:32}"
+	echo "ISO Volume label is too long, truncating to 32 characters" 1>&2
+	echo "old: '${old_clst_iso_volume_id}'" 1>&2
+	echo "new: '${clst_iso_volume_id}'" 1>&2
+fi
+
+# Generate list of checksums that genkernel can use to verify the contents of
+# the ISO
+isoroot_checksum() {
+	[ -z "${clst_livecd_verify}" ] && return
+
+	echo ">> Creating checksums for all files included in the ISO"
+
+	pushd "${clst_target_path}"
+	find -type f -exec b2sum {} + > /tmp/isoroot_b2sums
+	popd
+
+	mv /tmp/isoroot_b2sums "${clst_target_path}"/
+}
+
+run_mkisofs() {
+	isoroot_checksum
+
+	echo "Running \"mkisofs ${@}\""
+	mkisofs "${@}" || die "Cannot make ISO image"
+}
+
+# Here we actually create the ISO images for each architecture
+case ${clst_hostarch} in
+	alpha)
+		isoroot_checksum
+
+		echo ">> xorriso -as genisofs -alpha-boot boot/bootlx -R -l -J -V \"${clst_iso_volume_id}\" -o \"${1}\" \"${clst_target_path}\""
+		xorriso -as genisofs -alpha-boot boot/bootlx -R -l -J -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}" || die "Cannot make ISO image"
+	;;
+	arm)
+	;;
+	hppa)
+		echo ">> Running mkisofs to create iso image...."
+		run_mkisofs -R -l -J -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}"/
+		pushd "${clst_target_path}/"
+		palo -f boot/palo.conf -C "${1}"
+		popd
+	;;
+	mips)
+		if [[ ${clst_fstype} != squashfs ]]; then
+			die "SGI LiveCD(s) only support the 'squashfs' fstype!"
+		fi
+
+		# $clst_target_path/[kernels|arcload] already exists, create loopback and sgibootcd
+		[ ! -d "${clst_target_path}/loopback" ] && mkdir "${clst_target_path}/loopback"
+		[ ! -d "${clst_target_path}/sgibootcd" ] && mkdir "${clst_target_path}/sgibootcd"
+
+		# Setup variables
+		[ -f "${clst_target_path}/livecd" ] && rm -f "${clst_target_path}/livecd"
+		img="${clst_target_path}/loopback/image.squashfs"
+		knl="${clst_target_path}/kernels"
+		arc="${clst_target_path}/arcload"
+		cfg="${clst_target_path}/sgibootcd/sgibootcd.cfg"
+		echo "" > "${cfg}"
+
+		# If the image file exists in $clst_target_path, move it to the loopback dir
+		[ -e "${clst_target_path}/image.squashfs" ] \
+			&& mv -f "${clst_target_path}/image.squashfs" "${clst_target_path}/loopback"
+
+		# An sgibootcd config is essentially a collection of commandline params
+		# stored in a text file.  We could pass these on the command line, but it's
+		# far easier to generate a config file and pass it to sgibootcd versus using a
+		# ton of commandline params.
+		#
+		# f=	indicates files to go into DVH (disk volume header) in an SGI disklabel
+		#	    format: f=</path/to/file>@<DVH name>
+		# p0=	the first partition holds the LiveCD rootfs image
+		#	    format: p0=</path/to/image>
+		# p8=	the eighth partition is the DVH partition
+		# p10=	the tenth partition is the disk volume partition
+		#	    format: p8= is always "#dvh" and p10= is always "#volume"
+
+		# Add the kernels to the sgibootcd config
+		for x in ${clst_boot_kernel}; do
+			echo -e "f=${knl}/${x}@${x}" >> ${cfg}
+		done
+
+		# Next, the bootloader binaries and config
+		echo -e "f=${arc}/sash64@sash64" >> ${cfg}
+		echo -e "f=${arc}/sashARCS@sashARCS" >> ${cfg}
+		echo -e "f=${arc}/arc.cf@arc.cf" >> ${cfg}
+
+		# Next, the Loopback Image
+		echo -e "p0=${img}" >> ${cfg}
+
+		# Finally, the required SGI Partitions (dvh, volume)
+		echo -e "p8=#dvh" >> ${cfg}
+		echo -e "p10=#volume" >> ${cfg}
+
+		# All done; feed the config to sgibootcd and end up with an image
+		# c=	the config file
+		# o=	output image (burnable to CD; readable by fdisk)
+		/usr/bin/sgibootcd c=${cfg} o=${clst_iso}
+	;;
+	amd64|arm64|ia64|ppc*|powerpc*|sparc*|x86|i?86)
+		isoroot_checksum
+
+		extra_opts=("-joliet" "-iso-level" "3")
+		case ${clst_hostarch} in
+		sparc*) extra_opts+=("--sparc-boot") ;;
+		esac
+
+		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}"
+	;;
+esac
+exit  $?


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-09-27 23:45 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-09-27 23:45 UTC (permalink / raw
  To: gentoo-commits

commit:     72fa94c1173a367255ad06e2c2ec8c1994095f85
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 27 23:45:01 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 27 23:45:01 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=72fa94c1

Start rewriting things

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

 targets/support/create-qcow2.sh | 251 +++++++++++-----------------------------
 1 file changed, 68 insertions(+), 183 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index aa597a59..d0c65aa3 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -4,193 +4,78 @@ source ${clst_shdir}/support/functions.sh
 
 ## START RUNSCRIPT
 
-# Check for our CD ISO creation tools
-case ${clst_hostarch} in
-	alpha)
-		cdmaker="xorriso"
-		cdmakerpkg="dev-libs/libisoburn"
-		;;
-	mips)
-		cdmaker="sgibootcd"
-		cdmakerpkg="sys-boot/sgibootcd"
-		;;
-	ppc*|powerpc*|sparc*)
-		cdmaker="grub-mkrescue"
-		cdmakerpkg="dev-libs/libisoburn and sys-boot/grub:2"
-		;;
-	amd64|arm64|ia64|x86|i?86)
-		cdmaker="grub-mkrescue"
-		# grub-mkrescue requires:
-		#  xorriso from libisoburn
-		#  mkisofs from cdrtools
-		#  mformat from mtools
-		cdmakerpkg="sys-fs/mtools, dev-libs/libisoburn, sys-boot/grub:2, and app-cdr/cdrtools"
-		;;
-	*)
-		cdmaker="mkisofs"
-		cdmakerpkg="app-cdr/cdrtools"
-		;;
-esac
+# Supported host architectures: all that do UEFI boot and support the tools
+# Script parameters:
+#  - ${1}  output qcow2 file
+
+#
+# Configuration parameters:
+#  - clst_qcow2_size      (internal) size of the qcow2 image (GByte, default 20)
+#  - clst_qcow2_swapsize  size of the swap partition (GByte, default 0 = no partition)
+#  - clst_qcow2_efisize   size of the EFI boot partition (GByte, default 0.5)
+#  - clst_qcow2_roottype  type of the root partition (default xfs)
+#
+
+#
+# We only support one set of tools, based on
+#  - mkfs.vfat    ( sys-fs/dosfstools , for the EFI partition )
+#  - mkfs.xfs     ( sys-fs/xfsprogs , this might actually be configurable )
+#  - parted       ( sys-block/parted , for partitioning )
+#  - qemu-nbd     ( app-emulation/qemu , for accessing a qcow2 image file as device )
+#  - qemu-img     ( app-emulation/qemu , for creating a qcow2 image file )
+#
+# Let's assume these are deps of catalyst and thus present.
+#
+
+
+# create a new qcow2 disk image file
+qemu-img create -f qcow2 ${1} ${clst_qcow2_size}G || die "Cannot create qcow2 file"
+
+# connect the qcow2 file to a network block device
+# TODO: find next free device
+modprobe -q nbd
+qemu-nbd -c /dev/nbd0 -f qcow2 ${1} || die "Cannot connect qcow2 file to nbd"
+
+# create a GPT disklabel
+parted /dev/nbd0 mklabel gpt
+
+# create an EFI boot partition
+
+# if requested, create a swap partition
+
+# fill the rest of the image with the root partition
+
+# re-read the partition table
+partprobe /dev/nbd0
+
+# make a vfat filesystem in p1
+# /dev/nbd0p1
+
+# make a swap signature in p2
+
+# make a xxx filesystem in p3 (or p2 if no swap)
+
+# mount things
+
+# copy contents in
+
+# at this point we have a rudimentary working system
+# now we need to follow the handbook and do basic configuration
+# (locale, timezone, ssh)
+
+
+
+
+
+
+
+
+# old stuff
+
 
-[ ! -f /usr/bin/${cdmaker} ] \
-   && echo && echo && die \
-   "!!! /usr/bin/${cdmaker} is not found.  Have you merged ${cdmakerpkg}?" \
-   && echo && echo
-
-# If not volume ID is set, make up a sensible default
-if [ -z "${clst_iso_volume_id}" ]
-then
-	case ${clst_livecd_type} in
-		gentoo-*)
-			case ${clst_hostarch} in
-				alpha)
-					clst_iso_volume_id="Gentoo Linux - Alpha"
-				;;
-				amd64)
-					clst_iso_volume_id="Gentoo Linux - AMD64"
-				;;
-				arm)
-					clst_iso_volume_id="Gentoo Linux - ARM"
-				;;
-				arm64)
-					clst_iso_volume_id="Gentoo Linux - ARM64"
-				;;
-				hppa)
-					clst_iso_volume_id="Gentoo Linux - HPPA"
-				;;
-				ia64)
-					clst_iso_volume_id="Gentoo Linux - IA64"
-				;;
-				m68k)
-					clst_iso_volume_id="Gentoo Linux - M68K"
-				;;
-				mips)
-					clst_iso_volume_id="Gentoo Linux - MIPS"
-				;;
-				ppc*|powerpc*)
-					clst_iso_volume_id="Gentoo Linux - PowerPC"
-				;;
-				s390)
-					clst_iso_volume_id="Gentoo Linux - S390"
-				;;
-				sh)
-					clst_iso_volume_id="Gentoo Linux - SH"
-				;;
-				sparc*)
-					clst_iso_volume_id="Gentoo Linux - SPARC"
-				;;
-				x86)
-					clst_iso_volume_id="Gentoo Linux - x86"
-				;;
-				*)
-					clst_iso_volume_id="Catalyst LiveCD"
-				;;
-				esac
-	esac
-fi
-
-if [ "${#clst_iso_volume_id}" -gt 32 ]; then
-	old_clst_iso_volume_id=${clst_iso_volume_id}
-	clst_iso_volume_id="${clst_iso_volume_id:0:32}"
-	echo "ISO Volume label is too long, truncating to 32 characters" 1>&2
-	echo "old: '${old_clst_iso_volume_id}'" 1>&2
-	echo "new: '${clst_iso_volume_id}'" 1>&2
-fi
-
-# Generate list of checksums that genkernel can use to verify the contents of
-# the ISO
-isoroot_checksum() {
-	[ -z "${clst_livecd_verify}" ] && return
-
-	echo ">> Creating checksums for all files included in the ISO"
-
-	pushd "${clst_target_path}"
-	find -type f -exec b2sum {} + > /tmp/isoroot_b2sums
-	popd
-
-	mv /tmp/isoroot_b2sums "${clst_target_path}"/
-}
-
-run_mkisofs() {
-	isoroot_checksum
-
-	echo "Running \"mkisofs ${@}\""
-	mkisofs "${@}" || die "Cannot make ISO image"
-}
 
 # Here we actually create the ISO images for each architecture
 case ${clst_hostarch} in
-	alpha)
-		isoroot_checksum
-
-		echo ">> xorriso -as genisofs -alpha-boot boot/bootlx -R -l -J -V \"${clst_iso_volume_id}\" -o \"${1}\" \"${clst_target_path}\""
-		xorriso -as genisofs -alpha-boot boot/bootlx -R -l -J -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}" || die "Cannot make ISO image"
-	;;
-	arm)
-	;;
-	hppa)
-		echo ">> Running mkisofs to create iso image...."
-		run_mkisofs -R -l -J -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}"/
-		pushd "${clst_target_path}/"
-		palo -f boot/palo.conf -C "${1}"
-		popd
-	;;
-	mips)
-		if [[ ${clst_fstype} != squashfs ]]; then
-			die "SGI LiveCD(s) only support the 'squashfs' fstype!"
-		fi
-
-		# $clst_target_path/[kernels|arcload] already exists, create loopback and sgibootcd
-		[ ! -d "${clst_target_path}/loopback" ] && mkdir "${clst_target_path}/loopback"
-		[ ! -d "${clst_target_path}/sgibootcd" ] && mkdir "${clst_target_path}/sgibootcd"
-
-		# Setup variables
-		[ -f "${clst_target_path}/livecd" ] && rm -f "${clst_target_path}/livecd"
-		img="${clst_target_path}/loopback/image.squashfs"
-		knl="${clst_target_path}/kernels"
-		arc="${clst_target_path}/arcload"
-		cfg="${clst_target_path}/sgibootcd/sgibootcd.cfg"
-		echo "" > "${cfg}"
-
-		# If the image file exists in $clst_target_path, move it to the loopback dir
-		[ -e "${clst_target_path}/image.squashfs" ] \
-			&& mv -f "${clst_target_path}/image.squashfs" "${clst_target_path}/loopback"
-
-		# An sgibootcd config is essentially a collection of commandline params
-		# stored in a text file.  We could pass these on the command line, but it's
-		# far easier to generate a config file and pass it to sgibootcd versus using a
-		# ton of commandline params.
-		#
-		# f=	indicates files to go into DVH (disk volume header) in an SGI disklabel
-		#	    format: f=</path/to/file>@<DVH name>
-		# p0=	the first partition holds the LiveCD rootfs image
-		#	    format: p0=</path/to/image>
-		# p8=	the eighth partition is the DVH partition
-		# p10=	the tenth partition is the disk volume partition
-		#	    format: p8= is always "#dvh" and p10= is always "#volume"
-
-		# Add the kernels to the sgibootcd config
-		for x in ${clst_boot_kernel}; do
-			echo -e "f=${knl}/${x}@${x}" >> ${cfg}
-		done
-
-		# Next, the bootloader binaries and config
-		echo -e "f=${arc}/sash64@sash64" >> ${cfg}
-		echo -e "f=${arc}/sashARCS@sashARCS" >> ${cfg}
-		echo -e "f=${arc}/arc.cf@arc.cf" >> ${cfg}
-
-		# Next, the Loopback Image
-		echo -e "p0=${img}" >> ${cfg}
-
-		# Finally, the required SGI Partitions (dvh, volume)
-		echo -e "p8=#dvh" >> ${cfg}
-		echo -e "p10=#volume" >> ${cfg}
-
-		# All done; feed the config to sgibootcd and end up with an image
-		# c=	the config file
-		# o=	output image (burnable to CD; readable by fdisk)
-		/usr/bin/sgibootcd c=${cfg} o=${clst_iso}
-	;;
 	amd64|arm64|ia64|ppc*|powerpc*|sparc*|x86|i?86)
 		isoroot_checksum
 


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-02 21:47 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-02 21:47 UTC (permalink / raw
  To: gentoo-commits

commit:     8717fcfb083fa9bbf8367af28cb3459243688611
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  2 21:47:47 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Oct  2 21:47:47 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=8717fcfb

more

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

 targets/support/create-qcow2.sh | 58 ++++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 30 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index d0c65aa3..9b5dce12 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -15,6 +15,10 @@ source ${clst_shdir}/support/functions.sh
 #  - clst_qcow2_efisize   size of the EFI boot partition (GByte, default 0.5)
 #  - clst_qcow2_roottype  type of the root partition (default xfs)
 #
+export clst_qcow2_size=20
+export clst_qcow2_swapsize=0
+export clst_qcow2_efisize=0.5
+export clst_qcow2_roottype=xfs
 
 #
 # We only support one set of tools, based on
@@ -27,65 +31,59 @@ source ${clst_shdir}/support/functions.sh
 # Let's assume these are deps of catalyst and thus present.
 #
 
-
 # create a new qcow2 disk image file
 qemu-img create -f qcow2 ${1} ${clst_qcow2_size}G || die "Cannot create qcow2 file"
 
 # connect the qcow2 file to a network block device
 # TODO: find next free device
 modprobe -q nbd
-qemu-nbd -c /dev/nbd0 -f qcow2 ${1} || die "Cannot connect qcow2 file to nbd"
+qemu-nbd -c /dev/nbd0 -f qcow2 ${1} || die "Cannot connect qcow2 file to nbd0"
 
 # create a GPT disklabel
-parted /dev/nbd0 mklabel gpt
+parted -s /dev/nbd0 mklabel gpt || die "Cannot create disklabel"
 
 # create an EFI boot partition
+parted -s /dev/nbd0 -- mkpart efi fat32 1M {clst_qcow2_efisize}GiB || die "Cannot create EFI partition"
 
 # if requested, create a swap partition
 
 # fill the rest of the image with the root partition
+parted -s /dev/nbd0 -- mkpart root ${clst_qcow2_roottype} ${clst_qcow2_efisize}GiB -1s || die "Cannot create root partition"
 
 # re-read the partition table
-partprobe /dev/nbd0
+partprobe /dev/nbd0 || die "Probing partition table failed"
 
 # make a vfat filesystem in p1
-# /dev/nbd0p1
+mkfs.fat -F 32 /dev/nbd0p1 || die "Formatting EFI partition failed"
 
 # make a swap signature in p2
 
-# make a xxx filesystem in p3 (or p2 if no swap)
+# make a xfs filesystem in p3 (or p2 if no swap)
+mkfs.xfs /dev/nbd0p2 || die "Formatting root partition failed"
 
 # mount things
+# we need a mount point- how do we get one?
+my_mountpoint=/tmp/bla
+mkdir -p "${my_mountpoint}" || die "Could not create mount point"
+mount /dev/nbd0p2 "${my_mountpoint}" || die "Could not mount root partition"
+mount /dev/nbd0p1 "${my_mountpoint}/boot" || die "Could not mount boot partition"
 
 # copy contents in
+cp -a "${clst_target_path}"/* "${my_mountpoint}/"
 
 # at this point we have a rudimentary working system
-# now we need to follow the handbook and do basic configuration
-# (locale, timezone, ssh)
-
-
-
-
-
-
-
-
-# old stuff
+# now we need to follow the handbook and do some basic configuration
+# (locale, timezone, ssh) - though most of it will be done by cloud-init
 
 
+# now let's install an efi loader
+bootctl --no-variables --graceful install
 
-# Here we actually create the ISO images for each architecture
-case ${clst_hostarch} in
-	amd64|arm64|ia64|ppc*|powerpc*|sparc*|x86|i?86)
-		isoroot_checksum
+# unmount things
+umount "${my_mountpoint}/boot" || die "Could not unmount boot partition"
+umount "${my_mountpoint}" || die "Could not unmount root partition"
 
-		extra_opts=("-joliet" "-iso-level" "3")
-		case ${clst_hostarch} in
-		sparc*) extra_opts+=("--sparc-boot") ;;
-		esac
+# disconnect the nbd
+qemu-nbd -d /dev/nbd0 || die "Could not disconnect nbd0"
 
-		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}"
-	;;
-esac
-exit  $?
+# Finished...


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-05 15:48 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-05 15:48 UTC (permalink / raw
  To: gentoo-commits

commit:     f4d754708b8ef3a545e68a7bfc4f38ee42820808
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  5 15:47:55 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct  5 15:47:55 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=f4d75470

Somewhat complete qemu2 creation script

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

 targets/support/create-qcow2.sh | 60 +++++++++++++++++++++--------------------
 1 file changed, 31 insertions(+), 29 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index fc21093b..32486f15 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -10,14 +10,13 @@ source ${clst_shdir}/support/functions.sh
 
 #
 # Configuration parameters:
-#  - clst_qcow2_size      (internal) size of the qcow2 image (GByte, default 20)
-#  - clst_qcow2_swapsize  size of the swap partition (GByte, default 0 = no partition)
-#  - clst_qcow2_efisize   size of the EFI boot partition (GByte, default 0.5)
+#  (All sizes are in forms as understood by parted and qemu-img)
+#  - clst_qcow2_size      (internal) size of the qcow2 image (default 20GiB)
+#  - clst_qcow2_efisize   size of the EFI boot partition (default 512MiB)
 #  - clst_qcow2_roottype  type of the root partition (default xfs)
 #
-export clst_qcow2_size=20
-export clst_qcow2_swapsize=0
-export clst_qcow2_efisize=0.5
+export clst_qcow2_size=20GiB
+export clst_qcow2_efisize=512MiB
 export clst_qcow2_roottype=xfs
 
 #
@@ -44,47 +43,50 @@ parted -s /dev/nbd0 mklabel gpt || die "Cannot create disklabel"
 
 # create an EFI boot partition
 parted -s /dev/nbd0 -- mkpart efi fat32 1M {clst_qcow2_efisize}GiB || die "Cannot create EFI partition"
-# mark it as such
+# mark it as EFI boot partition
+parted -s /dev/nbd0 -- type 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B || die "Cannot set EFI partition UUID"
+# note down name
+mypartefi=/dev/nbd0p1
 
-# if requested, create a swap partition
-# mark it as such
-
-# fill the rest of the image with the root partition
+# create the root partition
 parted -s /dev/nbd0 -- mkpart root ${clst_qcow2_roottype} ${clst_qcow2_efisize}GiB -1M || die "Cannot create root partition"
-# mark it as such
+# mark it as generic linux filesystem partition
+parted -s /dev/nbd0 -- type 2 0FC63DAF-8483-4772-8E79-3D69D8477DE4 || die "Cannot set root partition UUID"
+# note down name
+mypartroot=/dev/nbd0p2
 
 # re-read the partition table
 partprobe /dev/nbd0 || die "Probing partition table failed"
 
 # make a vfat filesystem in p1
-mkfs.fat -F 32 /dev/nbd0p1 || die "Formatting EFI partition failed"
-
-# make a swap signature in p2
+mkfs.fat -F 32 ${mypartefi} || die "Formatting EFI partition failed"
 
-# make a xfs filesystem in p3 (or p2 if no swap)
-mkfs.xfs /dev/nbd0p2 || die "Formatting root partition failed"
+# make an xfs filesystem in p2
+mkfs.xfs ${mypartroot} || die "Formatting root partition failed"
 
 # mount things
 # we need a mount point- how do we get one?
-my_mountpoint=/tmp/bla
-mkdir -p "${my_mountpoint}" || die "Could not create mount point"
-mount /dev/nbd0p2 "${my_mountpoint}" || die "Could not mount root partition"
-mount /dev/nbd0p1 "${my_mountpoint}/boot" || die "Could not mount boot partition"
+mymountpoint=/tmp/bla
+mkdir -p "${mymountpoint}" || die "Could not create root mount point"
+mount /dev/nbd0p2 "${mymountpoint}" || die "Could not mount root partition"
+mkdir -p "${mymountpoint}"/boot || die "Could not create boot mount point"
+mount /dev/nbd0p1 "${mymountpoint}/boot" || die "Could not mount boot partition"
 
 # copy contents in
 cp -a "${clst_target_path}"/* "${my_mountpoint}/"
 
-# at this point we have a rudimentary working system
-# now we need to follow the handbook and do some basic configuration
-# (locale, timezone, ssh) - though most of it will be done by cloud-init
-
+# at this point we have a working system
 
-# now let's install an efi loader inside
-# bootctl --no-variables --graceful install
+# note: the following must already have been done by the stage2:
+# - rudimentary configuration
+# - installation of cloud-init
+# - installation of kernel
+# - installation of fallback efi loader
+# luckily efi requires no image magic, just regular files...
 
 # unmount things
-umount "${my_mountpoint}/boot" || die "Could not unmount boot partition"
-umount "${my_mountpoint}" || die "Could not unmount root partition"
+umount "${mymountpoint}/boot" || die "Could not unmount boot partition"
+umount "${mymountpoint}" || die "Could not unmount root partition"
 
 # disconnect the nbd
 qemu-nbd -d /dev/nbd0 || die "Could not disconnect nbd0"


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-05 19:15 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-05 19:15 UTC (permalink / raw
  To: gentoo-commits

commit:     74a62e27beb0c7a7e1967a49d5c75b72c22db6cb
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  5 19:14:31 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct  5 19:14:31 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=74a62e27

Add simplified qcow2 bootloader setup (do we really want grub?)

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

 targets/support/qcow2-bootloader-setup.sh | 69 +++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/targets/support/qcow2-bootloader-setup.sh b/targets/support/qcow2-bootloader-setup.sh
new file mode 100755
index 00000000..be577ada
--- /dev/null
+++ b/targets/support/qcow2-bootloader-setup.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+source ${clst_shdir}/support/functions.sh
+
+# $1 is the destination root
+
+if [[ -n ${clst_cdtar} ]]; then
+	extract_cdtar $1
+fi
+
+extract_kernels $1/boot
+
+cmdline_opts=()
+
+# Add any additional options
+if [ -n "${clst_qcow2_bootargs}" ]
+then
+	for x in ${clst_qcow2_bootargs}
+	do
+		cmdline_opts+=(${x})
+	done
+fi
+
+# Optional memtest setups
+memtest_grub() {
+  if [[ -e $1/memtest.efi64 ]]; then
+    echo 'if [ "x$grub_platform" = xefi ]; then'
+    echo '  menuentry "Memtest86+ 64bit UEFI" {'
+    echo '    chainloader "/memtest.efi64"'
+    echo '  }'
+    echo 'fi'
+  fi
+}
+
+default_append_line=(${cmdline_opts[@]})
+default_dracut_append_line=(${clst_qcow2_bootargs})
+
+case ${clst_hostarch} in
+	amd64|arm64|ppc64*)
+		kern_subdir=/boot
+		iacfg=$1/boot/grub/grub.cfg
+		mkdir -p $1/boot/grub
+		echo 'set default=0' > ${iacfg}
+		echo 'set gfxpayload=keep' >> ${iacfg}
+		echo 'set timeout=10' >> ${iacfg}
+		echo 'insmod all_video' >> ${iacfg}
+		echo '' >> ${iacfg}
+		for x in ${clst_boot_kernel}
+		do
+			eval "kernel_console=\$clst_boot_kernel_${x}_console"
+			eval "distkernel=\$clst_boot_kernel_${x}_distkernel"
+
+			echo "menuentry 'Boot Gentoo image (kernel: ${x})' --class gnu-linux --class os {"  >> ${iacfg}
+			if [ ${distkernel} = "yes" ]
+			then
+				# FIXME: what can we search for here?
+				echo "	search --no-floppy --set=root -l ${clst_iso_volume_id}" >> ${iacfg}
+				echo "	linux ${kern_subdir}/${x} ${default_dracut_append_line[@]}" >> ${iacfg}
+			else
+				echo "	linux ${kern_subdir}/${x} ${default_append_line[@]}" >> ${iacfg}
+			fi
+			echo "	initrd ${kern_subdir}/${x}.igz" >> ${iacfg}
+			echo "}" >> ${iacfg}
+			echo "" >> ${iacfg}
+		done
+		memtest_grub $1 >> ${iacfg}
+	;;
+esac
+exit $?


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-06 19:33 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-06 19:33 UTC (permalink / raw
  To: gentoo-commits

commit:     6292209ad2ed7e1f98c49d6470e921b3ecb8b753
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  6 19:31:50 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct  6 19:31:50 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=6292209a

Replace fixed with default values, insert variables, stream compression

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

 targets/support/create-qcow2.sh | 43 +++++++++++++++++++++++++----------------
 1 file changed, 26 insertions(+), 17 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 32486f15..d54691a8 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -15,9 +15,9 @@ source ${clst_shdir}/support/functions.sh
 #  - clst_qcow2_efisize   size of the EFI boot partition (default 512MiB)
 #  - clst_qcow2_roottype  type of the root partition (default xfs)
 #
-export clst_qcow2_size=20GiB
-export clst_qcow2_efisize=512MiB
-export clst_qcow2_roottype=xfs
+: "${clst_qcow2_size:=20GiB}"
+: "${clst_qcow2_efisize:=512MiB}"
+: "${clst_qcow2_roottype:=xfs}"
 
 #
 # We only support one set of tools, based on
@@ -31,32 +31,33 @@ export clst_qcow2_roottype=xfs
 #
 
 # create a new qcow2 disk image file
-qemu-img create -f qcow2 ${1} ${clst_qcow2_size}G || die "Cannot create qcow2 file"
+qemu-img create -f qcow2 "${1}.tmp.qcow2" ${clst_qcow2_size} || die "Cannot create qcow2 file"
 
 # connect the qcow2 file to a network block device
 # TODO: find next free device
 modprobe -q nbd
-qemu-nbd -c /dev/nbd0 -f qcow2 ${1} || die "Cannot connect qcow2 file to nbd0"
+mydevice=/dev/nbd0
+qemu-nbd -c ${mydevice} -f qcow2 "${1}.tmp.qcow2" || die "Cannot connect qcow2 file to nbd0"
 
 # create a GPT disklabel
-parted -s /dev/nbd0 mklabel gpt || die "Cannot create disklabel"
+parted -s ${mydevice} mklabel gpt || die "Cannot create disklabel"
 
 # create an EFI boot partition
-parted -s /dev/nbd0 -- mkpart efi fat32 1M {clst_qcow2_efisize}GiB || die "Cannot create EFI partition"
+parted -s ${mydevice} -- mkpart efi fat32 1M ${clst_qcow2_efisize} || die "Cannot create EFI partition"
 # mark it as EFI boot partition
-parted -s /dev/nbd0 -- type 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B || die "Cannot set EFI partition UUID"
+parted -s ${mydevice} -- type 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B || die "Cannot set EFI partition UUID"
 # note down name
-mypartefi=/dev/nbd0p1
+mypartefi=${mydevice}p1
 
 # create the root partition
-parted -s /dev/nbd0 -- mkpart root ${clst_qcow2_roottype} ${clst_qcow2_efisize}GiB -1M || die "Cannot create root partition"
+parted -s ${mydevice} -- mkpart root ${clst_qcow2_roottype} ${clst_qcow2_efisize}GiB -1M || die "Cannot create root partition"
 # mark it as generic linux filesystem partition
-parted -s /dev/nbd0 -- type 2 0FC63DAF-8483-4772-8E79-3D69D8477DE4 || die "Cannot set root partition UUID"
+parted -s ${mydevice} -- type 2 0FC63DAF-8483-4772-8E79-3D69D8477DE4 || die "Cannot set root partition UUID"
 # note down name
-mypartroot=/dev/nbd0p2
+mypartroot=${mydevice}p2
 
 # re-read the partition table
-partprobe /dev/nbd0 || die "Probing partition table failed"
+partprobe ${mydevice} || die "Probing partition table failed"
 
 # make a vfat filesystem in p1
 mkfs.fat -F 32 ${mypartefi} || die "Formatting EFI partition failed"
@@ -66,11 +67,11 @@ mkfs.xfs ${mypartroot} || die "Formatting root partition failed"
 
 # mount things
 # we need a mount point- how do we get one?
-mymountpoint=/tmp/bla
+mymountpoint="${1}.tmp.mnt"
 mkdir -p "${mymountpoint}" || die "Could not create root mount point"
-mount /dev/nbd0p2 "${mymountpoint}" || die "Could not mount root partition"
+mount ${mypartroot} "${mymountpoint}" || die "Could not mount root partition"
 mkdir -p "${mymountpoint}"/boot || die "Could not create boot mount point"
-mount /dev/nbd0p1 "${mymountpoint}/boot" || die "Could not mount boot partition"
+mount ${mypartefi} "${mymountpoint}/boot" || die "Could not mount boot partition"
 
 # copy contents in
 cp -a "${clst_target_path}"/* "${my_mountpoint}/"
@@ -89,6 +90,14 @@ umount "${mymountpoint}/boot" || die "Could not unmount boot partition"
 umount "${mymountpoint}" || die "Could not unmount root partition"
 
 # disconnect the nbd
-qemu-nbd -d /dev/nbd0 || die "Could not disconnect nbd0"
+qemu-nbd -d ${mydevice} || die "Could not disconnect nbd0"
+
+# rewrite with stream compression
+qemu-img convert -c -O qcow2 "${1}.tmp.qcow2" "${1}" || die "Could not compress QCOW2 file"
+
+# clean up
+rm "${1}.tmp.qcow2" || die "Could not delete uncompressed QCOW2 file"
+rmdir "${mymountpoint}/boot" || die "Could not remove boot mountpoint"
+rmdir "${mymountpoint}" || die "Could not remove root mountpoint"
 
 # Finished...


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-06 20:41 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-06 20:41 UTC (permalink / raw
  To: gentoo-commits

commit:     40bb07e9456e1583e8e4328c07ccf894b4792d92
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  6 20:40:57 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct  6 20:40:57 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=40bb07e9

Minor fixes to qcow2 creation script

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

 targets/support/create-qcow2.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index d54691a8..7d7dd2e7 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -73,16 +73,23 @@ mount ${mypartroot} "${mymountpoint}" || die "Could not mount root partition"
 mkdir -p "${mymountpoint}"/boot || die "Could not create boot mount point"
 mount ${mypartefi} "${mymountpoint}/boot" || die "Could not mount boot partition"
 
-# copy contents in
-cp -a "${clst_target_path}"/* "${my_mountpoint}/"
+# copy contents in - do we need extra preserve steps? rsync? tar?
+cp -a "${clst_target_path}"/* "${mymountpoint}/" || die "Could not copy content into mounted image"
 
 # at this point we have a working system
 
+# create a CONTENTS.gz file
+pushd "${mymountpoint}" || die "Could not cd into mountpoint"
+find . > "${1}.CONTENTS" || die "Could not list files in mountpoint"
+popd || die "Could not cd out of mountpoint"
+gzip "${1}.CONTENTS" || die "Could not compress file list"
+
 # note: the following must already have been done by the stage2:
 # - rudimentary configuration
 # - installation of cloud-init
 # - installation of kernel
 # - installation of fallback efi loader
+# - enabling of services
 # luckily efi requires no image magic, just regular files...
 
 # unmount things


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-06 21:57 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-06 21:57 UTC (permalink / raw
  To: gentoo-commits

commit:     222c9a9e554667a6531aa2229b178b3039d0f755
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  6 21:57:28 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct  6 21:57:28 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=222c9a9e

Fix the unit format, GiB => G for qemu-img

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

 targets/support/create-qcow2.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 7d7dd2e7..071dccac 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -10,7 +10,7 @@ source ${clst_shdir}/support/functions.sh
 
 #
 # Configuration parameters:
-#  (All sizes are in forms as understood by parted and qemu-img)
+# All sizes are in forms as understood by parted: use MiB, GiB, ... or M, G, ...
 #  - clst_qcow2_size      (internal) size of the qcow2 image (default 20GiB)
 #  - clst_qcow2_efisize   size of the EFI boot partition (default 512MiB)
 #  - clst_qcow2_roottype  type of the root partition (default xfs)
@@ -31,7 +31,7 @@ source ${clst_shdir}/support/functions.sh
 #
 
 # create a new qcow2 disk image file
-qemu-img create -f qcow2 "${1}.tmp.qcow2" ${clst_qcow2_size} || die "Cannot create qcow2 file"
+qemu-img create -f qcow2 "${1}.tmp.qcow2" ${clst_qcow2_size/%iB/} || die "Cannot create qcow2 file"
 
 # connect the qcow2 file to a network block device
 # TODO: find next free device


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-11 20:14 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-11 20:14 UTC (permalink / raw
  To: gentoo-commits

commit:     4cb160c076f04cc932aff3b658c051e7b402c4b4
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 11 20:13:29 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 11 20:13:29 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=4cb160c0

Configure bootloader in qcow2

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

 targets/support/create-qcow2.sh           |   4 +-
 targets/support/qcow2-bootloader-setup.sh | 182 +++---------------------------
 2 files changed, 20 insertions(+), 166 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 071dccac..9510cabb 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -43,14 +43,14 @@ qemu-nbd -c ${mydevice} -f qcow2 "${1}.tmp.qcow2" || die "Cannot connect qcow2 f
 parted -s ${mydevice} mklabel gpt || die "Cannot create disklabel"
 
 # create an EFI boot partition
-parted -s ${mydevice} -- mkpart efi fat32 1M ${clst_qcow2_efisize} || die "Cannot create EFI partition"
+parted -s ${mydevice} -- mkpart gentoo_efi fat32 1M ${clst_qcow2_efisize} || die "Cannot create EFI partition"
 # mark it as EFI boot partition
 parted -s ${mydevice} -- type 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B || die "Cannot set EFI partition UUID"
 # note down name
 mypartefi=${mydevice}p1
 
 # create the root partition
-parted -s ${mydevice} -- mkpart root ${clst_qcow2_roottype} ${clst_qcow2_efisize}GiB -1M || die "Cannot create root partition"
+parted -s ${mydevice} -- mkpart gentoo_root ${clst_qcow2_roottype} ${clst_qcow2_efisize}GiB -1M || die "Cannot create root partition"
 # mark it as generic linux filesystem partition
 parted -s ${mydevice} -- type 2 0FC63DAF-8483-4772-8E79-3D69D8477DE4 || die "Cannot set root partition UUID"
 # note down name

diff --git a/targets/support/qcow2-bootloader-setup.sh b/targets/support/qcow2-bootloader-setup.sh
index 34d95dc9..2bf6d873 100755
--- a/targets/support/qcow2-bootloader-setup.sh
+++ b/targets/support/qcow2-bootloader-setup.sh
@@ -2,112 +2,51 @@
 
 source ${clst_shdir}/support/functions.sh
 
-# $1 is the destination root
-
-if [[ -n ${clst_cdtar} ]]; then
-	extract_cdtar $1
-fi
-
-extract_kernels $1/boot
+# $1 would be the the destination root for an iso
+# ${clst_stage_path} is where the stage can be found
 
 cmdline_opts=()
+my_bootdir="${clst_stage_path}/boot"
 
 # Add any additional options
-if [ -n "${clst_livecd_bootargs}" ]
+if [ -n "${clst_diskimage_bootargs}" ]
 then
-	for x in ${clst_livecd_bootargs}
+	for x in ${clst_diskimage_bootargs}
 	do
 		cmdline_opts+=(${x})
 	done
 fi
 
-case ${clst_fstype} in
-	squashfs)
-		cmdline_opts+=(looptype=squashfs loop=/image.squashfs)
-	;;
-	jffs2)
-		cmdline_opts+=(looptype=jffs2 loop=/image.jffs2)
-	;;
-esac
-
 # Optional memtest setups
 memtest_grub() {
-  if [[ -e $1/memtest64.bios ]]; then
+  if [[ -e ${my_bootdir}/memtest64.bios ]]; then
     echo 'if [ "x$grub_platform" = xpc ]; then'
     echo '  menuentry "Memtest86+ 64bit BIOS" {'
     echo '    linux "/memtest64.bios"'
     echo '  }'
     echo 'fi'
   fi
-  if [[ -e $1/memtest.efi64 ]]; then
+  if [[ -e ${my_bootdir}/memtest.efi64 ]]; then
     echo 'if [ "x$grub_platform" = xefi ]; then'
     echo '  menuentry "Memtest86+ 64bit UEFI" {'
     echo '    chainloader "/memtest.efi64"'
     echo '  }'
     echo 'fi'
   fi
-  if [[ -e $1/memtest32.bios ]]; then
+  if [[ -e ${my_bootdir}/memtest32.bios ]]; then
     echo 'menuentry "Memtest86+ 32bit BIOS" {'
     echo '  linux "/memtest32.bios"'
     echo '}'
   fi
 }
 
-default_append_line=(${cmdline_opts[@]} cdroot)
-default_dracut_append_line=(${clst_livecd_bootargs} root=live:CDLABEL=${clst_iso_volume_id} rd.live.dir=/ rd.live.squashimg=image.squashfs cdroot)
+default_append_line=(${cmdline_opts[@]})
+default_dracut_append_line=(${clst_diskimage_bootargs} 'root="LABEL=gentoo_root"')
 
 case ${clst_hostarch} in
-	alpha)
-		# NO SOFTLEVEL SUPPORT YET
-		acfg=$1/etc/aboot.conf
-		bctr=0
-		# Pass 1 is for non-serial
-		for x in ${clst_boot_kernel}
-		do
-			echo -n "${bctr}:/boot/${x} " >> ${acfg}
-			echo -n "initrd=/boot/${x}.igz " >> ${acfg}
-			echo "${cmdline_opts[@]} cdroot" >> ${acfg}
-			((bctr=${bctr}+1))
-		done
-		# Pass 2 is for serial
-		cmdline_opts+=(console=ttyS0)
-		for x in ${clst_boot_kernel}
-		do
-			echo -n "${bctr}:/boot/${x} " >> ${acfg}
-			echo -n "initrd=/boot/${x}.igz " >> ${acfg}
-			echo "${cmdline_opts[@]} cdroot" >> ${acfg}
-			((bctr=${bctr}+1))
-		done
-	;;
-	arm)
-		# NO SOFTLEVEL SUPPORT YET
-	;;
-	hppa)
-		# NO SOFTLEVEL SUPPORT YET
-		mkdir -p $1/boot
-
-		icfg=$1/boot/palo.conf
-		kmsg=$1/boot/kernels.msg
-		hmsg=$1/boot/help.msg
-		# Make sure we strip the extension to the kernel to allow palo to choose
-		boot_kernel_common_name=${first/%32/}
-		boot_kernel_common_name=${boot_kernel_common_name/%64/}
-
-		# copy the bootloader for the final image
-		cp /usr/share/palo/iplboot $1/boot/
-
-		echo "--commandline=0/${boot_kernel_common_name} initrd=${first}.igz ${default_append_line[@]}" >> ${icfg}
-		echo "--bootloader=boot/iplboot" >> ${icfg}
-		echo "--ramdisk=boot/${first}.igz" >> ${icfg}
-		for x in ${clst_boot_kernel}
-		do
-			echo "--recoverykernel=boot/${x}" >> ${icfg}
-		done
-	;;
-	amd64|arm64|ia64|ppc*|powerpc*|sparc*|x86|i?86)
-		kern_subdir=/boot
-		iacfg=$1/boot/grub/grub.cfg
-		mkdir -p $1/boot/grub
+	amd64|arm64|ppc*)
+		iacfg=${my_bootdir}/grub/grub.cfg
+		mkdir -p ${my_bootdir}/grub
 		echo 'set default=0' > ${iacfg}
 		echo 'set gfxpayload=keep' >> ${iacfg}
 		echo 'set timeout=10' >> ${iacfg}
@@ -118,104 +57,19 @@ case ${clst_hostarch} in
 			eval "kernel_console=\$clst_boot_kernel_${x}_console"
 			eval "distkernel=\$clst_boot_kernel_${x}_distkernel"
 
-			echo "menuentry 'Boot LiveCD (kernel: ${x})' --class gnu-linux --class os {"  >> ${iacfg}
+			echo "menuentry 'Gentoo Linux (kernel: ${x})' --class gnu-linux --class os {"  >> ${iacfg}
 			if [ ${distkernel} = "yes" ]
 			then
-				echo "	search --no-floppy --set=root -l ${clst_iso_volume_id}" >> ${iacfg}
-				echo "	linux ${kern_subdir}/${x} ${default_dracut_append_line[@]}" >> ${iacfg}
+				echo "	search --no-floppy --set=root -l gentoo_efi" >> ${iacfg}
+				echo "	linux /${x} ${default_dracut_append_line[@]}" >> ${iacfg}
 			else
-				echo "	linux ${kern_subdir}/${x} ${default_append_line[@]}" >> ${iacfg}
+				echo "	linux /${x} ${default_append_line[@]}" >> ${iacfg}
 			fi
-			echo "	initrd ${kern_subdir}/${x}.igz" >> ${iacfg}
+			echo "	initrd /${x}.igz" >> ${iacfg}
 			echo "}" >> ${iacfg}
 			echo "" >> ${iacfg}
-			echo "menuentry 'Boot LiveCD (kernel: ${x}) (cached)' --class gnu-linux --class os {"  >> ${iacfg}
-			if [ ${distkernel} = "yes" ]
-			then
-				echo "	search --no-floppy --set=root -l ${clst_iso_volume_id}" >> ${iacfg}
-				echo "	linux ${kern_subdir}/${x} ${default_dracut_append_line[@]} rd.live.ram=1" >> ${iacfg}
-			else
-				echo "	linux ${kern_subdir}/${x} ${default_append_line[@]} docache" >> ${iacfg}
-			fi
-
-			echo "	initrd ${kern_subdir}/${x}.igz" >> ${iacfg}
-			echo "}" >> ${iacfg}
-			if [ -n "${kernel_console}" ]
-			then
-			echo "submenu 'Special console options (kernel: ${x})' --class gnu-linux --class os {" >> ${iacfg}
-				for y in ${kernel_console}
-				do
-					echo "menuentry 'Boot LiveCD (kernel: ${x} console=${y})' --class gnu-linux --class os {"  >> ${iacfg}
-					echo "	linux ${kern_subdir}/${x} ${default_append_line[@]} console=${y}" >> ${iacfg}
-					echo "	initrd ${kern_subdir}/${x}.igz" >> ${iacfg}
-					echo "}" >> ${iacfg}
-					echo "" >> ${iacfg}
-				done
-				echo "}" >> ${iacfg}
-			fi
-			echo "" >> ${iacfg}
 		done
 		memtest_grub $1 >> ${iacfg}
 	;;
-	mips)
-		# NO SOFTLEVEL SUPPORT YET
-
-		# Mips is an interesting arch -- where most archs will
-		# use ${1} as the root of the LiveCD, an SGI LiveCD lacks
-		# such a root.  Instead, we will use ${1} as a scratch
-		# directory to build the components we need for the
-		# CD image, and then pass these components to the
-		# `sgibootcd` tool which outputs a final CD image
-		scratch="${1}"
-		mkdir -p ${scratch}/{kernels/misc,arcload}
-		echo "" > ${scratch}/arc.cf
-
-		# Move kernel binaries to ${scratch}/kernels, and
-		# move everything else to ${scratch}/kernels/misc
-		for x in ${clst_boot_kernel}; do
-			[ -e "${1}/boot/${x}" ] && mv ${1}/boot/${x} ${scratch}/kernels
-			[ -e "${1}/boot/${x}.igz" ] && mv ${1}/boot/${x}.igz ${scratch}/kernels/misc
-		done
-		[ -d "${1}/boot" ] && rmdir ${1}/boot
-
-		# Source the arcload source file to generated required sections of arc.cf
-		source ${clst_shdir}/support/mips-arcload_conf.sh
-
-		# Generate top portions of the config
-		echo -e "${topofconfig}${serial}${dbg}${cmt1}" >> ${scratch}/arc.cf
-
-		# Next, figure out what kernels were specified in the
-		# spec file, and generate the appropriate arcload conf
-		# blocks specific to each system
-		ip22="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip22" | tr "\n" " ")"
-		ip27="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip27" | tr "\n" " ")"
-		ip28="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip28" | tr "\n" " ")"
-		ip30="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip30" | tr "\n" " ")"
-		ip32="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip32" | tr "\n" " ")"
-
-		if [ -n "${ip22}" ]; then
-			echo -e "${ip22base}" >> ${scratch}/arc.cf
-			for x in ${ip22}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
-			echo -e "${ip22vid}${ip22x}" >> ${scratch}/arc.cf
-		fi
-
-		[ -n "${ip27}" ] && echo -e "${ip27base}" >> ${scratch}/arc.cf
-		[ -n "${ip28}" ] && echo -e "${ip28base}" >> ${scratch}/arc.cf
-		[ -n "${ip30}" ] && echo -e "${ip30base}" >> ${scratch}/arc.cf
-
-		if [ -n "${ip32}" ]; then
-			echo -e "${ip32base}" >> ${scratch}/arc.cf
-			for x in ${ip32}; do echo -e "${!x}" >> ${scratch}/arc.cf; done
-			echo -e "${ip32vid}${ip32x}" >> ${scratch}/arc.cf
-		fi
-
-		# Finish off the config
-		echo -e "${cmt2}" >> ${scratch}/arc.cf
-
-		# Move the bootloader binaries & config to their destination
-		[ -e "${1}/sashARCS" ] && mv ${1}/sashARCS ${scratch}/arcload
-		[ -e "${1}/sash64" ] && mv ${1}/sash64 ${scratch}/arcload
-		[ -e "${1}/arc.cf" ] && mv ${1}/arc.cf ${scratch}/arcload
-		;;
 esac
 exit $?


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-11 22:07 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-11 22:07 UTC (permalink / raw
  To: gentoo-commits

commit:     bbd1c0850016b470e25728461325168091507d82
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 11 21:10:01 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 11 21:10:01 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=bbd1c085

Copy correct content into image

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

 targets/support/create-qcow2.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 9510cabb..2d7a046a 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -73,8 +73,8 @@ mount ${mypartroot} "${mymountpoint}" || die "Could not mount root partition"
 mkdir -p "${mymountpoint}"/boot || die "Could not create boot mount point"
 mount ${mypartefi} "${mymountpoint}/boot" || die "Could not mount boot partition"
 
-# copy contents in - do we need extra preserve steps? rsync? tar?
-cp -a "${clst_target_path}"/* "${mymountpoint}/" || die "Could not copy content into mounted image"
+# copy contents in; the source is the stage dir and not any "iso content"
+cp -a "${clst_stage_path}"/* "${mymountpoint}/" || die "Could not copy content into mounted image"
 
 # at this point we have a working system
 


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-11 22:07 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-11 22:07 UTC (permalink / raw
  To: gentoo-commits

commit:     2810d76d9481ded6f68d0faad642bd9b022436e3
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 11 22:07:25 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 11 22:07:25 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=2810d76d

Improve cleanup in case of errors

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

 targets/support/create-qcow2.sh | 74 ++++++++++++++++++++++++-----------------
 1 file changed, 43 insertions(+), 31 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 2d7a046a..7e3f2573 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -30,81 +30,93 @@ source ${clst_shdir}/support/functions.sh
 # Let's assume these are deps of catalyst and thus present.
 #
 
-# create a new qcow2 disk image file
-qemu-img create -f qcow2 "${1}.tmp.qcow2" ${clst_qcow2_size/%iB/} || die "Cannot create qcow2 file"
+mymountpoint="${1}.tmp.mnt"
 
-# connect the qcow2 file to a network block device
 # TODO: find next free device
 modprobe -q nbd
 mydevice=/dev/nbd0
-qemu-nbd -c ${mydevice} -f qcow2 "${1}.tmp.qcow2" || die "Cannot connect qcow2 file to nbd0"
+
+# This script requires slightly more stringent cleanup in case of errors...
+qcow2die() {
+	echo "Something went wrong. Cleaning up..."
+	# here we just ignore errors
+	umount "${mymountpoint}/boot"
+	umount "${mymountpoint}"
+	qemu-nbd -d "${mydevice}"
+
+	die $@
+}
+
+# create a new qcow2 disk image file
+qemu-img create -f qcow2 "${1}.tmp.qcow2" ${clst_qcow2_size/%iB/} || qcow2die "Cannot create qcow2 file"
+
+# connect the qcow2 file to a network block device
+qemu-nbd -c ${mydevice} -f qcow2 "${1}.tmp.qcow2" || qcow2die "Cannot connect qcow2 file to nbd0"
 
 # create a GPT disklabel
-parted -s ${mydevice} mklabel gpt || die "Cannot create disklabel"
+parted -s ${mydevice} mklabel gpt || qcow2die "Cannot create disklabel"
 
 # create an EFI boot partition
-parted -s ${mydevice} -- mkpart gentoo_efi fat32 1M ${clst_qcow2_efisize} || die "Cannot create EFI partition"
+parted -s ${mydevice} -- mkpart gentoo_efi fat32 1M ${clst_qcow2_efisize} || qcow2die "Cannot create EFI partition"
 # mark it as EFI boot partition
-parted -s ${mydevice} -- type 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B || die "Cannot set EFI partition UUID"
+parted -s ${mydevice} -- type 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B || qcow2die "Cannot set EFI partition UUID"
 # note down name
 mypartefi=${mydevice}p1
 
 # create the root partition
-parted -s ${mydevice} -- mkpart gentoo_root ${clst_qcow2_roottype} ${clst_qcow2_efisize}GiB -1M || die "Cannot create root partition"
+parted -s ${mydevice} -- mkpart gentoo_root ${clst_qcow2_roottype} ${clst_qcow2_efisize}GiB -1M || qcow2die "Cannot create root partition"
 # mark it as generic linux filesystem partition
-parted -s ${mydevice} -- type 2 0FC63DAF-8483-4772-8E79-3D69D8477DE4 || die "Cannot set root partition UUID"
+parted -s ${mydevice} -- type 2 0FC63DAF-8483-4772-8E79-3D69D8477DE4 || qcow2die "Cannot set root partition UUID"
 # note down name
 mypartroot=${mydevice}p2
 
 # re-read the partition table
-partprobe ${mydevice} || die "Probing partition table failed"
+partprobe ${mydevice} || qcow2die "Probing partition table failed"
 
 # make a vfat filesystem in p1
-mkfs.fat -F 32 ${mypartefi} || die "Formatting EFI partition failed"
+mkfs.fat -F 32 ${mypartefi} || qcow2die "Formatting EFI partition failed"
 
 # make an xfs filesystem in p2
-mkfs.xfs ${mypartroot} || die "Formatting root partition failed"
+mkfs.xfs ${mypartroot} || qcow2die "Formatting root partition failed"
 
 # mount things
-# we need a mount point- how do we get one?
-mymountpoint="${1}.tmp.mnt"
-mkdir -p "${mymountpoint}" || die "Could not create root mount point"
-mount ${mypartroot} "${mymountpoint}" || die "Could not mount root partition"
-mkdir -p "${mymountpoint}"/boot || die "Could not create boot mount point"
-mount ${mypartefi} "${mymountpoint}/boot" || die "Could not mount boot partition"
+mkdir -p "${mymountpoint}" || qcow2die "Could not create root mount point"
+mount ${mypartroot} "${mymountpoint}" || qcow2die "Could not mount root partition"
+mkdir -p "${mymountpoint}"/boot || qcow2die "Could not create boot mount point"
+mount ${mypartefi} "${mymountpoint}/boot" || qcow2die "Could not mount boot partition"
 
 # copy contents in; the source is the stage dir and not any "iso content"
-cp -a "${clst_stage_path}"/* "${mymountpoint}/" || die "Could not copy content into mounted image"
+cp -a "${clst_stage_path}"/* "${mymountpoint}/" || qcow2die "Could not copy content into mounted image"
 
 # at this point we have a working system
 
 # create a CONTENTS.gz file
-pushd "${mymountpoint}" || die "Could not cd into mountpoint"
-find . > "${1}.CONTENTS" || die "Could not list files in mountpoint"
-popd || die "Could not cd out of mountpoint"
-gzip "${1}.CONTENTS" || die "Could not compress file list"
+pushd "${mymountpoint}" || qcow2die "Could not cd into mountpoint"
+find . > "${1}.CONTENTS" || qcow2die "Could not list files in mountpoint"
+popd || qcow2die "Could not cd out of mountpoint"
+gzip "${1}.CONTENTS" || qcow2die "Could not compress file list"
 
 # note: the following must already have been done by the stage2:
 # - rudimentary configuration
-# - installation of cloud-init
+# - installation of cloud-init if requested
 # - installation of kernel
 # - installation of fallback efi loader
 # - enabling of services
 # luckily efi requires no image magic, just regular files...
 
 # unmount things
-umount "${mymountpoint}/boot" || die "Could not unmount boot partition"
-umount "${mymountpoint}" || die "Could not unmount root partition"
+umount "${mymountpoint}/boot" || qcow2die "Could not unmount boot partition"
+umount "${mymountpoint}" || qcow2die "Could not unmount root partition"
 
 # disconnect the nbd
-qemu-nbd -d ${mydevice} || die "Could not disconnect nbd0"
+qemu-nbd -d ${mydevice} || qcow2die "Could not disconnect nbd0"
 
 # rewrite with stream compression
-qemu-img convert -c -O qcow2 "${1}.tmp.qcow2" "${1}" || die "Could not compress QCOW2 file"
+qemu-img convert -c -O qcow2 "${1}.tmp.qcow2" "${1}" || qcow2die "Could not compress QCOW2 file"
 
 # clean up
-rm "${1}.tmp.qcow2" || die "Could not delete uncompressed QCOW2 file"
-rmdir "${mymountpoint}/boot" || die "Could not remove boot mountpoint"
-rmdir "${mymountpoint}" || die "Could not remove root mountpoint"
+rm "${1}.tmp.qcow2" || qcow2die "Could not delete uncompressed QCOW2 file"
+rmdir "${mymountpoint}/boot" || qcow2die "Could not remove boot mountpoint"
+rmdir "${mymountpoint}" || qcow2die "Could not remove root mountpoint"
 
 # Finished...


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-11 22:28 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-11 22:28 UTC (permalink / raw
  To: gentoo-commits

commit:     7cf09d5ca632ab6562e3ee1ccb779ba4b521165f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 11 22:27:55 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 11 22:27:55 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=7cf09d5c

Fix error output

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

 targets/support/create-qcow2.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 7e3f2573..419e1c4e 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -44,7 +44,7 @@ qcow2die() {
 	umount "${mymountpoint}"
 	qemu-nbd -d "${mydevice}"
 
-	die $@
+	die "$@"
 }
 
 # create a new qcow2 disk image file


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-11 22:28 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-11 22:28 UTC (permalink / raw
  To: gentoo-commits

commit:     42652771c0a17ae76bdbfc96130e681d52d7238c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 11 22:28:23 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 11 22:28:23 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=42652771

Make sure CONTENTS is created in the right place

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

 targets/support/create-qcow2.sh | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 419e1c4e..8ab12b9a 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -91,10 +91,8 @@ cp -a "${clst_stage_path}"/* "${mymountpoint}/" || qcow2die "Could not copy cont
 # at this point we have a working system
 
 # create a CONTENTS.gz file
-pushd "${mymountpoint}" || qcow2die "Could not cd into mountpoint"
-find . > "${1}.CONTENTS" || qcow2die "Could not list files in mountpoint"
-popd || qcow2die "Could not cd out of mountpoint"
-gzip "${1}.CONTENTS" || qcow2die "Could not compress file list"
+# warning: $1 does not contain a full path
+( pushd "${mymountpoint}" &> /dev/null ; ls -laR ; popd &> /dev/null ) > "${1}.CONTENTS" || qcow2die "Could not create CONTENTS file"
 
 # note: the following must already have been done by the stage2:
 # - rudimentary configuration


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-11 22:51 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-11 22:51 UTC (permalink / raw
  To: gentoo-commits

commit:     7f6002bac7dfcd9f262b291d27501c7fe35e9171
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 11 22:51:24 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 11 22:51:24 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=7f6002ba

Force all absolute paths and add lots of debug output

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

 targets/support/create-qcow2.sh | 52 ++++++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 24 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 8ab12b9a..d1f69f14 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -30,7 +30,9 @@ source ${clst_shdir}/support/functions.sh
 # Let's assume these are deps of catalyst and thus present.
 #
 
-mymountpoint="${1}.tmp.mnt"
+mycurrentdir="$(pwd)"
+mymountpoint="${mycurrentdir}/${1}.tmp.mnt"
+myqcow2="${mycurrentdir}/${1}"
 
 # TODO: find next free device
 modprobe -q nbd
@@ -40,59 +42,61 @@ mydevice=/dev/nbd0
 qcow2die() {
 	echo "Something went wrong. Cleaning up..."
 	# here we just ignore errors
-	umount "${mymountpoint}/boot"
-	umount "${mymountpoint}"
+	umount "${mydevice}p1"
+	umount "${mydevice}p2"
 	qemu-nbd -d "${mydevice}"
 
 	die "$@"
 }
 
-# create a new qcow2 disk image file
-qemu-img create -f qcow2 "${1}.tmp.qcow2" ${clst_qcow2_size/%iB/} || qcow2die "Cannot create qcow2 file"
+echo "Creating a new qcow2 disk image file"
+qemu-img create -f qcow2 "${myqcow2}.tmp.qcow2" ${clst_qcow2_size/%iB/} || qcow2die "Cannot create qcow2 file"
 
-# connect the qcow2 file to a network block device
-qemu-nbd -c ${mydevice} -f qcow2 "${1}.tmp.qcow2" || qcow2die "Cannot connect qcow2 file to nbd0"
+echo "Connecting the qcow2 file to network block device ${mydevice}"
+qemu-nbd -c ${mydevice} -f qcow2 "${myqcow2}.tmp.qcow2" || qcow2die "Cannot connect qcow2 file to nbd0"
 
-# create a GPT disklabel
+echo "Creating a GPT disklabel"
 parted -s ${mydevice} mklabel gpt || qcow2die "Cannot create disklabel"
 
-# create an EFI boot partition
+echo "Creating an EFI boot partition"
 parted -s ${mydevice} -- mkpart gentoo_efi fat32 1M ${clst_qcow2_efisize} || qcow2die "Cannot create EFI partition"
 # mark it as EFI boot partition
 parted -s ${mydevice} -- type 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B || qcow2die "Cannot set EFI partition UUID"
 # note down name
 mypartefi=${mydevice}p1
 
-# create the root partition
+echo "Creating the root partition"
 parted -s ${mydevice} -- mkpart gentoo_root ${clst_qcow2_roottype} ${clst_qcow2_efisize}GiB -1M || qcow2die "Cannot create root partition"
 # mark it as generic linux filesystem partition
 parted -s ${mydevice} -- type 2 0FC63DAF-8483-4772-8E79-3D69D8477DE4 || qcow2die "Cannot set root partition UUID"
 # note down name
 mypartroot=${mydevice}p2
 
-# re-read the partition table
+echo "Re-reading the partition table"
 partprobe ${mydevice} || qcow2die "Probing partition table failed"
 
-# make a vfat filesystem in p1
+echo "Making a vfat filesystem in p1"
 mkfs.fat -F 32 ${mypartefi} || qcow2die "Formatting EFI partition failed"
 
-# make an xfs filesystem in p2
+echo "Making an xfs filesystem in p2"
 mkfs.xfs ${mypartroot} || qcow2die "Formatting root partition failed"
 
-# mount things
+echo "Mounting things"
 mkdir -p "${mymountpoint}" || qcow2die "Could not create root mount point"
 mount ${mypartroot} "${mymountpoint}" || qcow2die "Could not mount root partition"
 mkdir -p "${mymountpoint}"/boot || qcow2die "Could not create boot mount point"
 mount ${mypartefi} "${mymountpoint}/boot" || qcow2die "Could not mount boot partition"
 
 # copy contents in; the source is the stage dir and not any "iso content"
+echo "Copying files into the mounted directories"
 cp -a "${clst_stage_path}"/* "${mymountpoint}/" || qcow2die "Could not copy content into mounted image"
 
 # at this point we have a working system
 
-# create a CONTENTS.gz file
-# warning: $1 does not contain a full path
-( pushd "${mymountpoint}" &> /dev/null ; ls -laR ; popd &> /dev/null ) > "${1}.CONTENTS" || qcow2die "Could not create CONTENTS file"
+echo "Creating a CONTENTS file"
+cd "${mymountpoint}/"                || qcow2die "Could not cd into mountpoint"
+ls -laR > "${myqcow2}.CONTENTS"      || qcow2die "Could not create CONTENTS file"
+cd "${mycurrentdir}"                 || qcow2die "Could not cd out of mountpoint"
 
 # note: the following must already have been done by the stage2:
 # - rudimentary configuration
@@ -102,18 +106,18 @@ cp -a "${clst_stage_path}"/* "${mymountpoint}/" || qcow2die "Could not copy cont
 # - enabling of services
 # luckily efi requires no image magic, just regular files...
 
-# unmount things
+echo "Unmounting things"
 umount "${mymountpoint}/boot" || qcow2die "Could not unmount boot partition"
 umount "${mymountpoint}" || qcow2die "Could not unmount root partition"
 
-# disconnect the nbd
-qemu-nbd -d ${mydevice} || qcow2die "Could not disconnect nbd0"
+echo "Disconnecting ${mydevice}"
+qemu-nbd -d ${mydevice} || qcow2die "Could not disconnect ${mydevice}"
 
-# rewrite with stream compression
-qemu-img convert -c -O qcow2 "${1}.tmp.qcow2" "${1}" || qcow2die "Could not compress QCOW2 file"
+echo "Rewriting the qcow2 with stream compression"
+qemu-img convert -c -O qcow2 "${myqcow2}.tmp.qcow2" "${myqcow2}" || qcow2die "Could not compress QCOW2 file"
 
-# clean up
-rm "${1}.tmp.qcow2" || qcow2die "Could not delete uncompressed QCOW2 file"
+echo "Cleaning up"
+rm "${myqcow2}.tmp.qcow2" || qcow2die "Could not delete uncompressed QCOW2 file"
 rmdir "${mymountpoint}/boot" || qcow2die "Could not remove boot mountpoint"
 rmdir "${mymountpoint}" || qcow2die "Could not remove root mountpoint"
 


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-11 23:01 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-11 23:01 UTC (permalink / raw
  To: gentoo-commits

commit:     f4edc20480774eb6f0f413a859c697dd494cd641
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 11 23:01:15 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 11 23:01:15 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=f4edc204

Dont try to clean up stuff that doesnt exist

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

 targets/support/create-qcow2.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index d1f69f14..5eb582c2 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -118,7 +118,6 @@ qemu-img convert -c -O qcow2 "${myqcow2}.tmp.qcow2" "${myqcow2}" || qcow2die "Co
 
 echo "Cleaning up"
 rm "${myqcow2}.tmp.qcow2" || qcow2die "Could not delete uncompressed QCOW2 file"
-rmdir "${mymountpoint}/boot" || qcow2die "Could not remove boot mountpoint"
-rmdir "${mymountpoint}" || qcow2die "Could not remove root mountpoint"
+rmdir "${mymountpoint}" || qcow2die "Could not remove mountpoint"
 
 # Finished...


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-11 23:09 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-11 23:09 UTC (permalink / raw
  To: gentoo-commits

commit:     e8318559cc4f9371746dad66067b961727e9de2c
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 11 23:09:20 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Oct 11 23:09:20 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=e8318559

Compress CONTENTS

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

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

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 5eb582c2..ff317b8a 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -98,6 +98,9 @@ cd "${mymountpoint}/"                || qcow2die "Could not cd into mountpoint"
 ls -laR > "${myqcow2}.CONTENTS"      || qcow2die "Could not create CONTENTS file"
 cd "${mycurrentdir}"                 || qcow2die "Could not cd out of mountpoint"
 
+echo "Compressing the CONTENTS file"
+gzip "${myqcow2}.CONTENTS"      || qcow2die "Could not compress the CONTENTS file"
+
 # note: the following must already have been done by the stage2:
 # - rudimentary configuration
 # - installation of cloud-init if requested


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 14:29 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 14:29 UTC (permalink / raw
  To: gentoo-commits

commit:     5beccf3249ee273c9c84ead6491981ace7d3d2a6
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 14:22:22 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 14:22:22 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=5beccf32

Improve logging output

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

 targets/support/create-qcow2.sh | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 62bfe136..fcf93d34 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -48,7 +48,7 @@ qcow2die() {
 	die "$@"
 }
 
-echo "Creating a new qcow2 disk image file"
+echo "Creating a new qcow2 disk image file ${myqcow2}.tmp.qcow2 with size ${clst_qcow2_size/%iB/}"
 qemu-img create -f qcow2 "${myqcow2}.tmp.qcow2" ${clst_qcow2_size/%iB/} || qcow2die "Cannot create qcow2 file"
 
 echo "Connecting the qcow2 file to network block device ${mydevice}"
@@ -74,25 +74,28 @@ mypartroot=${mydevice}p2
 echo "Re-reading the partition table"
 partprobe ${mydevice} || qcow2die "Probing partition table failed"
 
+echo "Printing the partition table"
+parted -s ${mydevice} -- print || qcow2die "Printing the partition table failed"
+
 echo "Making a vfat filesystem in p1"
-mkfs.fat -F 32 ${mypartefi} || qcow2die "Formatting EFI partition failed"
+mkfs.fat -v -F 32 ${mypartefi} || qcow2die "Formatting EFI partition failed"
 
 echo "Making an xfs filesystem in p2"
 mkfs.xfs ${mypartroot} || qcow2die "Formatting root partition failed"
 
-echo "Mounting things"
+echo "Mounting things at ${mymountpoint}"
 mkdir -p "${mymountpoint}" || qcow2die "Could not create root mount point"
 mount ${mypartroot} "${mymountpoint}" || qcow2die "Could not mount root partition"
 mkdir -p "${mymountpoint}"/boot || qcow2die "Could not create boot mount point"
 mount ${mypartefi} "${mymountpoint}/boot" || qcow2die "Could not mount boot partition"
 
 # copy contents in; the source is the stage dir and not any "iso content"
-echo "Copying files into the mounted directories"
+echo "Copying files into the mounted directories from ${clst_stage_path}"
 cp -a "${clst_stage_path}"/* "${mymountpoint}/" || qcow2die "Could not copy content into mounted image"
 
 # at this point we have a working system
 
-echo "Creating a CONTENTS file"
+echo "Creating a CONTENTS file ${myqcow2}.CONTENTS"
 pushd "${mymountpoint}/" &> /dev/null || qcow2die "Could not cd into mountpoint"
 ls -laR > "${myqcow2}.CONTENTS"       || qcow2die "Could not create CONTENTS file"
 popd &> /dev/null                     || qcow2die "Could not cd out of mountpoint"
@@ -115,7 +118,7 @@ umount "${mymountpoint}" || qcow2die "Could not unmount root partition"
 echo "Disconnecting ${mydevice}"
 qemu-nbd -d ${mydevice} || qcow2die "Could not disconnect ${mydevice}"
 
-echo "Rewriting the qcow2 with stream compression"
+echo "Rewriting the qcow2 file with stream compression to ${myqcow2}"
 qemu-img convert -c -O qcow2 "${myqcow2}.tmp.qcow2" "${myqcow2}" || qcow2die "Could not compress QCOW2 file"
 
 echo "Cleaning up"


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 14:54 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 14:54 UTC (permalink / raw
  To: gentoo-commits

commit:     d4ebafe44dc67c631d61509b61064895afb7312d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 14:37:27 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 14:37:27 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=d4ebafe4

Dont try to remove nbd that wasnt set up by us

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

 targets/support/create-qcow2.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index fcf93d34..2d100b80 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -37,7 +37,8 @@ myqcow2="${1}"
 modprobe -q nbd
 mydevice=/dev/nbd0
 
-# This script requires slightly more stringent cleanup in case of errors...
+# This script requires slightly more stringent cleanup in case of errors
+# from the moment on when the nbd was set up...
 qcow2die() {
 	echo "Something went wrong. Cleaning up..."
 	# here we just ignore errors
@@ -49,10 +50,10 @@ qcow2die() {
 }
 
 echo "Creating a new qcow2 disk image file ${myqcow2}.tmp.qcow2 with size ${clst_qcow2_size/%iB/}"
-qemu-img create -f qcow2 "${myqcow2}.tmp.qcow2" ${clst_qcow2_size/%iB/} || qcow2die "Cannot create qcow2 file"
+qemu-img create -f qcow2 "${myqcow2}.tmp.qcow2" ${clst_qcow2_size/%iB/} || die "Cannot create qcow2 file"
 
 echo "Connecting the qcow2 file to network block device ${mydevice}"
-qemu-nbd -c ${mydevice} -f qcow2 "${myqcow2}.tmp.qcow2" || qcow2die "Cannot connect qcow2 file to nbd0"
+qemu-nbd -c ${mydevice} -f qcow2 "${myqcow2}.tmp.qcow2" || die "Cannot connect qcow2 file to nbd0"
 
 echo "Creating a GPT disklabel"
 parted -s ${mydevice} mklabel gpt || qcow2die "Cannot create disklabel"


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 15:18 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 15:18 UTC (permalink / raw
  To: gentoo-commits

commit:     c172974ab5b22137b74096d937cd9d0f8ed866bd
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 15:17:56 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 15:17:56 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=c172974a

Provide full path for grub-install

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

 targets/support/qcow2-installation.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/targets/support/qcow2-installation.sh b/targets/support/qcow2-installation.sh
index 68dd781b..17f32aa6 100755
--- a/targets/support/qcow2-installation.sh
+++ b/targets/support/qcow2-installation.sh
@@ -5,5 +5,5 @@ source /tmp/chroot-functions.sh
 # basic system setup
 
 # now we install grub into the future EFI partition
-grub-install --verbose --no-floppy --efi-directory=/boot --removable --skip-fs-probe \
+/usr/sbin/grub-install --verbose --no-floppy --efi-directory=/boot --removable --skip-fs-probe \
 	--no-nvram --no-bootsector --target=x86_64-efi || die "grub-install failed"


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 16:29 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 16:29 UTC (permalink / raw
  To: gentoo-commits

commit:     5ac6234f0932bd10acd1d0d64faf262a9d312771
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 16:29:35 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 16:29:35 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=5ac6234f

For chrooting into the mount point, add a lot of NIH

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

 targets/support/create-qcow2.sh | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index b41d635a..dfc1309a 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -41,7 +41,13 @@ mydevice=/dev/nbd0
 # from the moment on when the nbd was set up...
 qcow2die() {
 	echo "Something went wrong. Cleaning up..."
+
 	# here we just ignore errors
+	umount "${mymountpoint}/proc"
+	umount "${mymountpoint}/sys"
+	umount "${mymountpoint}/dev"
+	umount "${mymountpoint}/run"
+
 	umount "${mydevice}p1"
 	umount "${mydevice}p2"
 	qemu-nbd -d "${mydevice}"
@@ -50,23 +56,39 @@ qcow2die() {
 }
 
 # We need a means to execute a script inside the qcow with filesystems mounted
+# Which means reproducing half of catalyst here.
 exec_in_qcow2() {
 	local file_name=$(basename ${1})
 
+	# prepare qcow2 for chrooting
+	mount --types proc /proc "${mymountpoint}/proc"
+	mount --rbind /sys "${mymountpoint}/sys"
+	mount --make-rslave "${mymountpoint}/sys"
+	mount --rbind /dev "${mymountpoint}/dev"
+	mount --make-rslave "${mymountpoint}/dev"
+	mount --bind /run "${mymountpoint}/run"
+	mount --make-slave "${mymountpoint}/run"
+
 	# copy_to_chroot ${1}
-	cp -pPR "${1}" "${mymountpoint}/tmp" || die
+	cp -pPR "${1}" "${mymountpoint}/tmp" || qcow2die
         # copy_to_chroot ${clst_shdir}/support/chroot-functions.sh
-        cp -pPR "${clst_shdir}/support/chroot-functions.sh" "${mymountpoint}/tmp" || die
+        cp -pPR "${clst_shdir}/support/chroot-functions.sh" "${mymountpoint}/tmp" || qcow2die
 
         # Ensure the file has the executable bit set
-        chmod +x "${mymountpoint}/tmp/${file_name}" || die
+        chmod +x "${mymountpoint}/tmp/${file_name}" || qcow2die
 
         echo "Running ${file_name} in qcow2:"
         echo "    ${clst_CHROOT} ${mymountpoint} /tmp/${file_name}"
-        ${clst_CHROOT} "${mymountpoint}" "/tmp/${file_name}" || exit 1
+        ${clst_CHROOT} "${mymountpoint}" "/tmp/${file_name}" || qcow2die
+
+        rm -f "${mymountpoint}/tmp/${file_name}" || qcow2die
+        rm -f "${mymountpoint}/tmp/chroot-functions.sh" || qcow2die
 
-        rm -f "${mymountpoint}/tmp/${file_name}" || die
-        rm -f "${mymountpoint}/tmp/chroot-functions.sh" || die
+	# cleanup qcow2 dir
+	umount "${mymountpoint}/proc" || qcow2die
+	umount "${mymountpoint}/sys" || qcow2die
+	umount "${mymountpoint}/dev" || qcow2die
+	umount "${mymountpoint}/run" || qcow2die
 }
 
 


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 16:43 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 16:43 UTC (permalink / raw
  To: gentoo-commits

commit:     9f20a1656c37b0c4d9fcb2505e2e80b9aa8d8a8b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 16:42:49 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 16:42:49 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=9f20a165

Really install grub

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

 targets/support/create-qcow2.sh       | 18 ++++++++----------
 targets/support/qcow2-grub-install.sh |  5 ++---
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index dfc1309a..06e1ec39 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -43,10 +43,10 @@ qcow2die() {
 	echo "Something went wrong. Cleaning up..."
 
 	# here we just ignore errors
-	umount "${mymountpoint}/proc"
-	umount "${mymountpoint}/sys"
-	umount "${mymountpoint}/dev"
-	umount "${mymountpoint}/run"
+	umount -R "${mymountpoint}/proc"
+	umount -R "${mymountpoint}/sys"
+	umount -R "${mymountpoint}/dev"
+	umount -R "${mymountpoint}/run"
 
 	umount "${mydevice}p1"
 	umount "${mydevice}p2"
@@ -85,10 +85,10 @@ exec_in_qcow2() {
         rm -f "${mymountpoint}/tmp/chroot-functions.sh" || qcow2die
 
 	# cleanup qcow2 dir
-	umount "${mymountpoint}/proc" || qcow2die
-	umount "${mymountpoint}/sys" || qcow2die
-	umount "${mymountpoint}/dev" || qcow2die
-	umount "${mymountpoint}/run" || qcow2die
+	umount -R "${mymountpoint}/proc" || qcow2die
+	umount -R "${mymountpoint}/sys" || qcow2die
+	umount -R "${mymountpoint}/dev" || qcow2die
+	umount -R "${mymountpoint}/run" || qcow2die
 }
 
 
@@ -138,8 +138,6 @@ echo "Copying files into the mounted directories from ${clst_stage_path}"
 cp -a "${clst_stage_path}"/* "${mymountpoint}/" || qcow2die "Could not copy content into mounted image"
 
 # now we can chroot in and install grub
-#/usr/sbin/grub-install --verbose --no-floppy --efi-directory=/boot --removable --skip-fs-probe \
-#       --no-nvram --no-bootsector --target=x86_64-efi || die "grub-install failed"
 exec_in_qcow2 "${clst_shdir}/support/qcow2-grub-install.sh"
 
 echo "Creating a CONTENTS file ${myqcow2}.CONTENTS"

diff --git a/targets/support/qcow2-grub-install.sh b/targets/support/qcow2-grub-install.sh
index e1bda92b..31194262 100755
--- a/targets/support/qcow2-grub-install.sh
+++ b/targets/support/qcow2-grub-install.sh
@@ -2,6 +2,5 @@
 
 source /tmp/chroot-functions.sh
 
-# install the boot loader here
-
-/bin/bash
+# install the boot loader
+grub-install --no-floppy --efi-directory=/boot --removable --skip-fs-probe --no-nvram --no-bootsector --target=x86_64-efi


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 17:52 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 17:52 UTC (permalink / raw
  To: gentoo-commits

commit:     71e3d18876d3b2a825f45bc7a812d262ffbff1e7
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 17:51:46 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 17:51:46 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=71e3d188

Provide some very basic configuration

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

 targets/support/diskimage-installation.sh | 51 +++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index 8599112b..14052f6a 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -2,7 +2,54 @@
 
 source /tmp/chroot-functions.sh
 
-# do some basic system setup here
+if [[ $(readlink /etc/portage/make.profile) == *systemd* ]] ; then
 
-# we can't install the boot loader because nothing is mounted anywhere
+# We are using systemd.
 
+# Types of bootable disk images planned for (diskimage/type):
+# cloud-init - an image that starts cloud-init for configuration and then can be
+#              used out of the box
+# console    - an image that has an empty root password and allows passwordless
+#              login on the console only
+# ssh        - an image that populates /root/.ssh/authorized_keys and starts dhcp
+#              as well as sshd; obviously not fit for public distribution
+# generic    - an image with no means of logging in... needs postprocessing
+#              no services are started
+
+# Set up basic services
+echo "Running systemctl preset-all"
+systemctl preset-all || die "Running systemctl preset-all failed"
+
+# Provide configuration for systemd-firstboot
+# We need enough information so all questions are skipped
+mysfconfigfile=/etc/systemd/system/systemd-firstboot.service.d/00gentoo.conf
+
+mysfconfig_console=$(cat <<END
+[Service]
+ExecStart=systemd-firstboot --locale=en_US.UTF-8 --timezone=UTC --delete-root-password
+END
+
+echo "Disk image type is ${clst_diskimage_type}"
+case ${clst_diskimage_type} in
+	generic)
+		echo "Setting up generic image (warning, not very useful on its own)"
+		;;
+	console)
+		echo "Setting up console image. Please change the root password."
+		echo "${mysfconfig_console}" > "${mysfconfigfile}"
+		;;
+	*)
+		die "As yet unsupported image type"
+		;;
+esac
+
+else
+
+# We are using OpenRC.
+
+die "OpenRC is as yet unsupported."
+
+fi
+
+# all done
+# (we can't install the boot loader here because nothing is mounted)


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 17:58 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 17:58 UTC (permalink / raw
  To: gentoo-commits

commit:     ad2a183ed5c202a6e8716bc32ee511e1a13b8c14
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 17:58:12 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 17:58:39 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=ad2a183e

Here's an extra ) for consumption

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

 targets/support/diskimage-installation.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index 14052f6a..6293c04d 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -28,6 +28,7 @@ mysfconfig_console=$(cat <<END
 [Service]
 ExecStart=systemd-firstboot --locale=en_US.UTF-8 --timezone=UTC --delete-root-password
 END
+)
 
 echo "Disk image type is ${clst_diskimage_type}"
 case ${clst_diskimage_type} in


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 19:01 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 19:01 UTC (permalink / raw
  To: gentoo-commits

commit:     05dc5bb921536d326029ec025047ce9f6a82caa0
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 19:01:38 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 19:01:38 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=05dc5bb9

Remove underscore and add debug output

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

 targets/support/create-qcow2.sh           | 7 +++++--
 targets/support/diskimage-installation.sh | 1 +
 targets/support/qcow2-bootloader-setup.sh | 4 ++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 06e1ec39..9bee8906 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -102,14 +102,14 @@ echo "Creating a GPT disklabel"
 parted -s ${mydevice} mklabel gpt || qcow2die "Cannot create disklabel"
 
 echo "Creating an EFI boot partition"
-parted -s ${mydevice} -- mkpart gentoo_efi fat32 1M ${clst_qcow2_efisize} || qcow2die "Cannot create EFI partition"
+parted -s ${mydevice} -- mkpart gentooefi fat32 1M ${clst_qcow2_efisize} || qcow2die "Cannot create EFI partition"
 # mark it as EFI boot partition
 parted -s ${mydevice} -- type 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B || qcow2die "Cannot set EFI partition UUID"
 # note down name
 mypartefi=${mydevice}p1
 
 echo "Creating the root partition"
-parted -s ${mydevice} -- mkpart gentoo_root ${clst_qcow2_roottype} ${clst_qcow2_efisize}GiB -1M || qcow2die "Cannot create root partition"
+parted -s ${mydevice} -- mkpart gentooroot ${clst_qcow2_roottype} ${clst_qcow2_efisize}GiB -1M || qcow2die "Cannot create root partition"
 # mark it as generic linux filesystem partition
 parted -s ${mydevice} -- type 2 0FC63DAF-8483-4772-8E79-3D69D8477DE4 || qcow2die "Cannot set root partition UUID"
 # note down name
@@ -127,6 +127,9 @@ mkfs.fat -v -F 32 ${mypartefi} || qcow2die "Formatting EFI partition failed"
 echo "Making an xfs filesystem in p2"
 mkfs.xfs ${mypartroot} || qcow2die "Formatting root partition failed"
 
+echo "Printing blkid output"
+blkid ${mydevice} || qcow2die "blkid failed"
+
 echo "Mounting things at ${mymountpoint}"
 mkdir -p "${mymountpoint}" || qcow2die "Could not create root mount point"
 mount ${mypartroot} "${mymountpoint}" || qcow2die "Could not mount root partition"

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index 6293c04d..7abe62fb 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -22,6 +22,7 @@ systemctl preset-all || die "Running systemctl preset-all failed"
 
 # Provide configuration for systemd-firstboot
 # We need enough information so all questions are skipped
+mkdir -p /etc/systemd/system/systemd-firstboot.service.d || die "mkdir failed"
 mysfconfigfile=/etc/systemd/system/systemd-firstboot.service.d/00gentoo.conf
 
 mysfconfig_console=$(cat <<END

diff --git a/targets/support/qcow2-bootloader-setup.sh b/targets/support/qcow2-bootloader-setup.sh
index 2bf6d873..ff338126 100755
--- a/targets/support/qcow2-bootloader-setup.sh
+++ b/targets/support/qcow2-bootloader-setup.sh
@@ -41,7 +41,7 @@ memtest_grub() {
 }
 
 default_append_line=(${cmdline_opts[@]})
-default_dracut_append_line=(${clst_diskimage_bootargs} 'root="LABEL=gentoo_root"')
+default_dracut_append_line=(${clst_diskimage_bootargs} 'root="LABEL=gentooroot"')
 
 case ${clst_hostarch} in
 	amd64|arm64|ppc*)
@@ -60,7 +60,7 @@ case ${clst_hostarch} in
 			echo "menuentry 'Gentoo Linux (kernel: ${x})' --class gnu-linux --class os {"  >> ${iacfg}
 			if [ ${distkernel} = "yes" ]
 			then
-				echo "	search --no-floppy --set=root -l gentoo_efi" >> ${iacfg}
+				echo "	search --no-floppy --set=root -l gentooefi" >> ${iacfg}
 				echo "	linux /${x} ${default_dracut_append_line[@]}" >> ${iacfg}
 			else
 				echo "	linux /${x} ${default_append_line[@]}" >> ${iacfg}


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 20:48 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 20:48 UTC (permalink / raw
  To: gentoo-commits

commit:     eaba8da233aa1837ff180fb3c00b79038e1e7747
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 20:48:27 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 20:48:47 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=eaba8da2

Use grub-mkconfig instead of our self-made mess

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

 targets/support/diskimage-installation.sh |  1 -
 targets/support/qcow2-bootloader-setup.sh | 56 -------------------------------
 targets/support/qcow2-grub-install.sh     |  5 ++-
 3 files changed, 4 insertions(+), 58 deletions(-)

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index 7abe62fb..1d80a9be 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -16,7 +16,6 @@ if [[ $(readlink /etc/portage/make.profile) == *systemd* ]] ; then
 # generic    - an image with no means of logging in... needs postprocessing
 #              no services are started
 
-# Set up basic services
 echo "Running systemctl preset-all"
 systemctl preset-all || die "Running systemctl preset-all failed"
 

diff --git a/targets/support/qcow2-bootloader-setup.sh b/targets/support/qcow2-bootloader-setup.sh
index ff338126..eb59cc52 100755
--- a/targets/support/qcow2-bootloader-setup.sh
+++ b/targets/support/qcow2-bootloader-setup.sh
@@ -17,59 +17,3 @@ then
 	done
 fi
 
-# Optional memtest setups
-memtest_grub() {
-  if [[ -e ${my_bootdir}/memtest64.bios ]]; then
-    echo 'if [ "x$grub_platform" = xpc ]; then'
-    echo '  menuentry "Memtest86+ 64bit BIOS" {'
-    echo '    linux "/memtest64.bios"'
-    echo '  }'
-    echo 'fi'
-  fi
-  if [[ -e ${my_bootdir}/memtest.efi64 ]]; then
-    echo 'if [ "x$grub_platform" = xefi ]; then'
-    echo '  menuentry "Memtest86+ 64bit UEFI" {'
-    echo '    chainloader "/memtest.efi64"'
-    echo '  }'
-    echo 'fi'
-  fi
-  if [[ -e ${my_bootdir}/memtest32.bios ]]; then
-    echo 'menuentry "Memtest86+ 32bit BIOS" {'
-    echo '  linux "/memtest32.bios"'
-    echo '}'
-  fi
-}
-
-default_append_line=(${cmdline_opts[@]})
-default_dracut_append_line=(${clst_diskimage_bootargs} 'root="LABEL=gentooroot"')
-
-case ${clst_hostarch} in
-	amd64|arm64|ppc*)
-		iacfg=${my_bootdir}/grub/grub.cfg
-		mkdir -p ${my_bootdir}/grub
-		echo 'set default=0' > ${iacfg}
-		echo 'set gfxpayload=keep' >> ${iacfg}
-		echo 'set timeout=10' >> ${iacfg}
-		echo 'insmod all_video' >> ${iacfg}
-		echo '' >> ${iacfg}
-		for x in ${clst_boot_kernel}
-		do
-			eval "kernel_console=\$clst_boot_kernel_${x}_console"
-			eval "distkernel=\$clst_boot_kernel_${x}_distkernel"
-
-			echo "menuentry 'Gentoo Linux (kernel: ${x})' --class gnu-linux --class os {"  >> ${iacfg}
-			if [ ${distkernel} = "yes" ]
-			then
-				echo "	search --no-floppy --set=root -l gentooefi" >> ${iacfg}
-				echo "	linux /${x} ${default_dracut_append_line[@]}" >> ${iacfg}
-			else
-				echo "	linux /${x} ${default_append_line[@]}" >> ${iacfg}
-			fi
-			echo "	initrd /${x}.igz" >> ${iacfg}
-			echo "}" >> ${iacfg}
-			echo "" >> ${iacfg}
-		done
-		memtest_grub $1 >> ${iacfg}
-	;;
-esac
-exit $?

diff --git a/targets/support/qcow2-grub-install.sh b/targets/support/qcow2-grub-install.sh
index 31194262..850eb72a 100755
--- a/targets/support/qcow2-grub-install.sh
+++ b/targets/support/qcow2-grub-install.sh
@@ -2,5 +2,8 @@
 
 source /tmp/chroot-functions.sh
 
-# install the boot loader
+echo "Installing grub with target x86_64-efi"
 grub-install --no-floppy --efi-directory=/boot --removable --skip-fs-probe --no-nvram --no-bootsector --target=x86_64-efi
+
+echo "Creating grub configuration"
+grub-mkconfig -o /boot/grub/grub.cfg


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 21:15 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 21:15 UTC (permalink / raw
  To: gentoo-commits

commit:     5ade97b7fb8ab3b3d0002b716aa3fb3cd8f44f98
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 21:15:05 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 21:15:05 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=5ade97b7

minor fixes

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

 targets/support/diskimage-installation.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index 1d80a9be..7237694f 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -19,6 +19,9 @@ if [[ $(readlink /etc/portage/make.profile) == *systemd* ]] ; then
 echo "Running systemctl preset-all"
 systemctl preset-all || die "Running systemctl preset-all failed"
 
+echo "Setting machine-id uninitialized"
+echo "uninitialized" > /etc/machine-id || die "Failed setting machine-id uninitialized"
+
 # Provide configuration for systemd-firstboot
 # We need enough information so all questions are skipped
 mkdir -p /etc/systemd/system/systemd-firstboot.service.d || die "mkdir failed"
@@ -26,7 +29,7 @@ mysfconfigfile=/etc/systemd/system/systemd-firstboot.service.d/00gentoo.conf
 
 mysfconfig_console=$(cat <<END
 [Service]
-ExecStart=systemd-firstboot --locale=en_US.UTF-8 --timezone=UTC --delete-root-password
+ExecStart=systemd-firstboot --locale=en_US.utf8 --timezone=UTC --delete-root-password
 END
 )
 


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 21:39 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 21:39 UTC (permalink / raw
  To: gentoo-commits

commit:     369cc4120b16d3cc43065d573a25719d05c38637
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 21:39:17 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 21:39:17 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=369cc412

Need to set machine-id late else it gets wiped again

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

 targets/support/create-qcow2.sh           | 3 +++
 targets/support/diskimage-installation.sh | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 82892c07..d650ea91 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -140,6 +140,9 @@ mount ${mypartefi} "${mymountpoint}/boot" || qcow2die "Could not mount boot part
 echo "Copying files into the mounted directories from ${clst_stage_path}"
 cp -a "${clst_stage_path}"/* "${mymountpoint}/" || qcow2die "Could not copy content into mounted image"
 
+echo "Setting machine-id to uninitialized"
+echo "uninitialized" > "${mymountpoint}/etc/machine-id" || qcow2die "Could not set machine-id to uninitialized"
+
 # now we can chroot in and install grub
 exec_in_qcow2 "${clst_shdir}/support/qcow2-grub-install.sh"
 

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index 7237694f..a7c042ef 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -19,9 +19,6 @@ if [[ $(readlink /etc/portage/make.profile) == *systemd* ]] ; then
 echo "Running systemctl preset-all"
 systemctl preset-all || die "Running systemctl preset-all failed"
 
-echo "Setting machine-id uninitialized"
-echo "uninitialized" > /etc/machine-id || die "Failed setting machine-id uninitialized"
-
 # Provide configuration for systemd-firstboot
 # We need enough information so all questions are skipped
 mkdir -p /etc/systemd/system/systemd-firstboot.service.d || die "mkdir failed"


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 21:39 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 21:39 UTC (permalink / raw
  To: gentoo-commits

commit:     33b7f1a47ca495b70d80f1c3c62098439cd6c883
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 21:30:36 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 21:30:36 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=33b7f1a4

Also run blkid on partitions

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

 targets/support/create-qcow2.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index 9bee8906..82892c07 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -128,7 +128,7 @@ echo "Making an xfs filesystem in p2"
 mkfs.xfs ${mypartroot} || qcow2die "Formatting root partition failed"
 
 echo "Printing blkid output"
-blkid ${mydevice} || qcow2die "blkid failed"
+blkid ${mydevice}* || qcow2die "blkid failed"
 
 echo "Mounting things at ${mymountpoint}"
 mkdir -p "${mymountpoint}" || qcow2die "Could not create root mount point"


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 21:58 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 21:58 UTC (permalink / raw
  To: gentoo-commits

commit:     9e2d04532a04f5e0f6bdecb6e810e871d29a925a
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 21:58:45 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 21:58:45 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=9e2d0453

Make the fstab

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

 targets/support/diskimage-installation.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index a7c042ef..30437257 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -16,6 +16,19 @@ if [[ $(readlink /etc/portage/make.profile) == *systemd* ]] ; then
 # generic    - an image with no means of logging in... needs postprocessing
 #              no services are started
 
+echo "Generating /etc/fstab"
+cat > /etc/fstab <<END
+# /etc/fstab: static file system information.
+#
+# See the manpage fstab(5) for more information.
+#
+# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>
+
+LABEL=gentooroot            /               xfs              noatime,rw   0 1
+LABEL=gentooefi             /boot           vfat             defaults     1 2
+
+END
+
 echo "Running systemctl preset-all"
 systemctl preset-all || die "Running systemctl preset-all failed"
 


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 22:06 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 22:06 UTC (permalink / raw
  To: gentoo-commits

commit:     ce5750581507d233815f5efeeaf01aeb04248ed7
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 22:06:11 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 22:06:11 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=ce575058

We need to add fstab late otherwise the kernel install gets confused

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

 targets/support/create-qcow2.sh           | 13 +++++++++++++
 targets/support/diskimage-installation.sh | 13 -------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index d650ea91..d90ec541 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -146,6 +146,19 @@ echo "uninitialized" > "${mymountpoint}/etc/machine-id" || qcow2die "Could not s
 # now we can chroot in and install grub
 exec_in_qcow2 "${clst_shdir}/support/qcow2-grub-install.sh"
 
+echo "Generating /etc/fstab"
+cat > "${mymountpoint}/etc/fstab" <<END
+# /etc/fstab: static file system information.
+#
+# See the manpage fstab(5) for more information.
+#
+# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>
+
+LABEL=gentooroot            /               xfs              noatime,rw   0 1
+LABEL=gentooefi             /boot           vfat             defaults     1 2
+
+END
+
 echo "Creating a CONTENTS file ${myqcow2}.CONTENTS"
 pushd "${mymountpoint}/" &> /dev/null || qcow2die "Could not cd into mountpoint"
 ls -laR > "${myqcow2}.CONTENTS"       || qcow2die "Could not create CONTENTS file"

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index ac53cef2..fc1b7df9 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -16,19 +16,6 @@ if [[ $(readlink /etc/portage/make.profile) == *systemd* ]] ; then
 # generic    - an image with no means of logging in... needs postprocessing
 #              no services are started
 
-echo "Generating /etc/fstab"
-cat > /etc/fstab <<END
-# /etc/fstab: static file system information.
-#
-# See the manpage fstab(5) for more information.
-#
-# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>
-
-LABEL=gentooroot            /               xfs              noatime,rw   0 1
-LABEL=gentooefi             /boot           vfat             defaults     1 2
-
-END
-
 echo "Generating /etc/locale.gen"
 cat > /etc/locale.gen <<END
 en_US ISO-8859-1


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 22:06 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 22:06 UTC (permalink / raw
  To: gentoo-commits

commit:     642cbbd07569f36073a26036dd5342e69d74289e
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 22:03:11 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 22:03:11 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=642cbbd0

Reduce locales

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

 targets/support/diskimage-installation.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index 30437257..ac53cef2 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -29,6 +29,12 @@ LABEL=gentooefi             /boot           vfat             defaults     1 2
 
 END
 
+echo "Generating /etc/locale.gen"
+cat > /etc/locale.gen <<END
+en_US ISO-8859-1
+en_US.UTF-8 UTF-8
+END
+
 echo "Running systemctl preset-all"
 systemctl preset-all || die "Running systemctl preset-all failed"
 


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 22:18 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 22:18 UTC (permalink / raw
  To: gentoo-commits

commit:     73f0242cd4c4744393f9281464f56b2c14eeb089
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 22:18:03 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 22:18:03 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=73f0242c

Add labels to filesystems. How quaint.

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

 targets/support/create-qcow2.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index d90ec541..f7c1a08a 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -122,10 +122,10 @@ echo "Printing the partition table"
 parted -s ${mydevice} -- print || qcow2die "Printing the partition table failed"
 
 echo "Making a vfat filesystem in p1"
-mkfs.fat -v -F 32 ${mypartefi} || qcow2die "Formatting EFI partition failed"
+mkfs.fat -v -F 32 -n gentooefi ${mypartefi} || qcow2die "Formatting EFI partition failed"
 
 echo "Making an xfs filesystem in p2"
-mkfs.xfs ${mypartroot} || qcow2die "Formatting root partition failed"
+mkfs.xfs -L gentooroot ${mypartroot} || qcow2die "Formatting root partition failed"
 
 echo "Printing blkid output"
 blkid ${mydevice}* || qcow2die "blkid failed"


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-12 22:56 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 22:56 UTC (permalink / raw
  To: gentoo-commits

commit:     2f17bbed9c7b26bf2b99a4e7db1480a446a53385
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 22:55:59 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 22:55:59 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=2f17bbed

one more try

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

 targets/support/diskimage-installation.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index fc1b7df9..5d9ff2e1 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -19,7 +19,7 @@ if [[ $(readlink /etc/portage/make.profile) == *systemd* ]] ; then
 echo "Generating /etc/locale.gen"
 cat > /etc/locale.gen <<END
 en_US ISO-8859-1
-en_US.UTF-8 UTF-8
+en_US.utf8 UTF-8
 END
 
 echo "Running systemctl preset-all"
@@ -32,7 +32,7 @@ mysfconfigfile=/etc/systemd/system/systemd-firstboot.service.d/00gentoo.conf
 
 mysfconfig_console=$(cat <<END
 [Service]
-ExecStart=systemd-firstboot --locale=en_US.utf8 --timezone=UTC --delete-root-password
+ExecStart=systemd-firstboot --locale=en_US.utf8 --keymap=us --timezone=UTC --root-password=gentoo
 END
 )
 


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-13 12:43 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-13 12:43 UTC (permalink / raw
  To: gentoo-commits

commit:     3c2d2560342a8bc8b6aecb00d7940fbc6dc03e12
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 13 12:43:14 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 13 12:43:14 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=3c2d2560

New attempt at systemd-firstboot

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

 targets/support/create-qcow2.sh           |  8 ++++++--
 targets/support/diskimage-installation.sh | 20 ++++++--------------
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh
index f7c1a08a..0073a25c 100755
--- a/targets/support/create-qcow2.sh
+++ b/targets/support/create-qcow2.sh
@@ -140,8 +140,12 @@ mount ${mypartefi} "${mymountpoint}/boot" || qcow2die "Could not mount boot part
 echo "Copying files into the mounted directories from ${clst_stage_path}"
 cp -a "${clst_stage_path}"/* "${mymountpoint}/" || qcow2die "Could not copy content into mounted image"
 
-echo "Setting machine-id to uninitialized"
-echo "uninitialized" > "${mymountpoint}/etc/machine-id" || qcow2die "Could not set machine-id to uninitialized"
+echo "Setting machine-id to empty"
+# We are already running systemd-firstboot in a previous step, so we don't want to run it again.
+# The documented behaviour for an empty machine-id is that systemd generates a new one and commits
+# it on first boot, but otherwise treats the system as already initialized.
+rm -f "${mymountpoint}/etc/machine-id"
+touch "${mymountpoint}/etc/machine-id" || qcow2die "Could not set machine-id to empty"
 
 # now we can chroot in and install grub
 exec_in_qcow2 "${clst_shdir}/support/qcow2-grub-install.sh"

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index 5d9ff2e1..c7ee4f0b 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -19,31 +19,23 @@ if [[ $(readlink /etc/portage/make.profile) == *systemd* ]] ; then
 echo "Generating /etc/locale.gen"
 cat > /etc/locale.gen <<END
 en_US ISO-8859-1
-en_US.utf8 UTF-8
+en_US.UTF-8 UTF-8
 END
 
 echo "Running systemctl preset-all"
 systemctl preset-all || die "Running systemctl preset-all failed"
 
-# Provide configuration for systemd-firstboot
-# We need enough information so all questions are skipped
-mkdir -p /etc/systemd/system/systemd-firstboot.service.d || die "mkdir failed"
-mysfconfigfile=/etc/systemd/system/systemd-firstboot.service.d/00gentoo.conf
-
-mysfconfig_console=$(cat <<END
-[Service]
-ExecStart=systemd-firstboot --locale=en_US.utf8 --keymap=us --timezone=UTC --root-password=gentoo
-END
-)
-
 echo "Disk image type is ${clst_diskimage_type}"
 case ${clst_diskimage_type} in
 	generic)
 		echo "Setting up generic image (warning, not very useful on its own)"
+		echo "Running systemd-firstboot"
+		systemd-firstboot --locale=en_US.UTF-8 --keymap=us --timezone=UTC || die "Failed running systemd-firstboot"
 		;;
 	console)
-		echo "Setting up console image. Please change the root password."
-		echo "${mysfconfig_console}" > "${mysfconfigfile}"
+		echo "Setting up console log-in image. Please set the root password ASAP."
+		echo "Running systemd-firstboot"
+		systemd-firstboot --locale=en_US.UTF-8 --keymap=us --timezone=UTC --delete-root-password || die "Failed running systemd-firstboot"
 		;;
 	*)
 		die "As yet unsupported image type"


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-13 13:02 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-13 13:02 UTC (permalink / raw
  To: gentoo-commits

commit:     b83c0a6bb8726be79cec3eca1d2cbfa40bf481cd
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 13 13:02:12 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 13 13:02:12 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=b83c0a6b

Do more things the oldfashoned way. Quaint but works.

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

 targets/support/diskimage-installation.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index c7ee4f0b..d357a1d7 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -25,17 +25,23 @@ END
 echo "Running systemctl preset-all"
 systemctl preset-all || die "Running systemctl preset-all failed"
 
+echo "Setting locale"
+echo "en_US.UTF-8" > /etc/locale.conf || die "Failed to set locale"
+
+echo "Setting keymap"
+echo "KEYMAP=us" > /etc/vconsole.conf || die "Failed to set keymap"
+
 echo "Disk image type is ${clst_diskimage_type}"
 case ${clst_diskimage_type} in
 	generic)
 		echo "Setting up generic image (warning, not very useful on its own)"
 		echo "Running systemd-firstboot"
-		systemd-firstboot --locale=en_US.UTF-8 --keymap=us --timezone=UTC || die "Failed running systemd-firstboot"
+		systemd-firstboot --timezone=UTC || die "Failed running systemd-firstboot"
 		;;
 	console)
 		echo "Setting up console log-in image. Please set the root password ASAP."
 		echo "Running systemd-firstboot"
-		systemd-firstboot --locale=en_US.UTF-8 --keymap=us --timezone=UTC --delete-root-password || die "Failed running systemd-firstboot"
+		systemd-firstboot --timezone=UTC --delete-root-password || die "Failed running systemd-firstboot"
 		;;
 	*)
 		die "As yet unsupported image type"


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-13 13:35 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-13 13:35 UTC (permalink / raw
  To: gentoo-commits

commit:     78a553bf80c525f7ec8d6959c9bf185dc15e1c08
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 13 13:35:09 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 13 13:35:09 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=78a553bf

Set root password manually. Works now.

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

 targets/support/diskimage-installation.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index 2f5bec7c..45d870a5 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -27,6 +27,7 @@ systemctl preset-all || die "Running systemctl preset-all failed"
 
 echo "Setting locale"
 echo 'LANG="en_US.UTF-8"' > /etc/locale.conf || die "Failed to set locale"
+env-update || die "Failed to run env-update"
 
 echo "Setting keymap"
 echo "KEYMAP=us" > /etc/vconsole.conf || die "Failed to set keymap"
@@ -40,8 +41,10 @@ case ${clst_diskimage_type} in
 		;;
 	console)
 		echo "Setting up console log-in image. Please set the root password ASAP."
+		echo "Removing root password"
+		passwd -d root || die "Failed removing root password"
 		echo "Running systemd-firstboot"
-		systemd-firstboot --timezone=UTC --delete-root-password || die "Failed running systemd-firstboot"
+		systemd-firstboot --timezone=UTC || die "Failed running systemd-firstboot"
 		;;
 	*)
 		die "As yet unsupported image type"


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/
@ 2024-10-13 13:35 Andreas K. Hüttel
  0 siblings, 0 replies; 41+ messages in thread
From: Andreas K. Hüttel @ 2024-10-13 13:35 UTC (permalink / raw
  To: gentoo-commits

commit:     aba024d865338878fde1559d73e1e2c4c2f1c401
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 13 13:07:11 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 13 13:07:11 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=aba024d8

Set locale properly

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

 targets/support/diskimage-installation.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/targets/support/diskimage-installation.sh b/targets/support/diskimage-installation.sh
index d357a1d7..2f5bec7c 100755
--- a/targets/support/diskimage-installation.sh
+++ b/targets/support/diskimage-installation.sh
@@ -26,7 +26,7 @@ echo "Running systemctl preset-all"
 systemctl preset-all || die "Running systemctl preset-all failed"
 
 echo "Setting locale"
-echo "en_US.UTF-8" > /etc/locale.conf || die "Failed to set locale"
+echo 'LANG="en_US.UTF-8"' > /etc/locale.conf || die "Failed to set locale"
 
 echo "Setting keymap"
 echo "KEYMAP=us" > /etc/vconsole.conf || die "Failed to set keymap"


^ permalink raw reply related	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2024-10-13 13:35 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09 19:34 [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: targets/support/ Andreas K. Hüttel
  -- strict thread matches above, loose matches on Subject: below --
2024-10-13 13:35 Andreas K. Hüttel
2024-10-13 13:35 Andreas K. Hüttel
2024-10-13 13:02 Andreas K. Hüttel
2024-10-13 12:43 Andreas K. Hüttel
2024-10-12 22:56 Andreas K. Hüttel
2024-10-12 22:18 Andreas K. Hüttel
2024-10-12 22:06 Andreas K. Hüttel
2024-10-12 22:06 Andreas K. Hüttel
2024-10-12 21:58 Andreas K. Hüttel
2024-10-12 21:39 Andreas K. Hüttel
2024-10-12 21:39 Andreas K. Hüttel
2024-10-12 21:15 Andreas K. Hüttel
2024-10-12 20:48 Andreas K. Hüttel
2024-10-12 19:01 Andreas K. Hüttel
2024-10-12 17:58 Andreas K. Hüttel
2024-10-12 17:52 Andreas K. Hüttel
2024-10-12 16:43 Andreas K. Hüttel
2024-10-12 16:29 Andreas K. Hüttel
2024-10-12 15:18 Andreas K. Hüttel
2024-10-12 14:54 Andreas K. Hüttel
2024-10-12 14:29 Andreas K. Hüttel
2024-10-11 23:09 Andreas K. Hüttel
2024-10-11 23:01 Andreas K. Hüttel
2024-10-11 22:51 Andreas K. Hüttel
2024-10-11 22:28 Andreas K. Hüttel
2024-10-11 22:28 Andreas K. Hüttel
2024-10-11 22:07 Andreas K. Hüttel
2024-10-11 22:07 Andreas K. Hüttel
2024-10-11 20:14 Andreas K. Hüttel
2024-10-06 21:57 Andreas K. Hüttel
2024-10-06 20:41 Andreas K. Hüttel
2024-10-06 19:33 Andreas K. Hüttel
2024-10-05 19:15 Andreas K. Hüttel
2024-10-05 15:48 Andreas K. Hüttel
2024-10-02 21:47 Andreas K. Hüttel
2024-09-27 23:45 Andreas K. Hüttel
2024-09-27 23:04 Andreas K. Hüttel
2024-08-09 19:34 Andreas K. Hüttel
2024-08-09 19:34 Andreas K. Hüttel
2024-08-09 19:34 Andreas K. Hüttel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox