public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/catalyst:master commit in: targets/support/, catalyst/targets/
@ 2018-04-05 18:19 Richard Farina
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Farina @ 2018-04-05 18:19 UTC (permalink / raw
  To: gentoo-commits

commit:     272d0006341034d108ca2335d41f75835099384b
Author:     Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Thu Apr  5 18:18:56 2018 +0000
Commit:     Richard Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Thu Apr  5 18:18:56 2018 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=272d0006

helps a tiny bit to actually tell catalyst to use the new value

 catalyst/targets/livecd_stage2.py   |  2 +-
 targets/support/bootloader-setup.sh | 19 ++++++++++++--
 targets/support/create-iso.sh       |  2 +-
 targets/support/functions.sh        | 52 +++++++++++++++++++++++++++++++++----
 4 files changed, 66 insertions(+), 9 deletions(-)

diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 63f77ac3..b7ab0fb8 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -18,7 +18,7 @@ class livecd_stage2(StageBase):
 		self.valid_values=[]
 
 		self.valid_values.extend(self.required_values)
-		self.valid_values.extend(["livecd/cdtar","livecd/empty","livecd/rm",\
+		self.valid_values.extend(["livecd/cdtar","livecd/empty","livecd/rm","livecd/depclean"\
 			"livecd/unmerge","livecd/iso","livecd/gk_mainargs","livecd/type",\
 			"livecd/readme","livecd/motd","livecd/overlay",\
 			"livecd/modblacklist","livecd/splash_theme","livecd/rcadd",\

diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh
index 33e26874..9da6c969 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -5,7 +5,20 @@ source ${clst_shdir}/support/filesystem-functions.sh
 
 # $1 is the destination root
 
-extract_cdtar $1
+# We handle boot loader a little special.  Most arches require a cdtar with bootloader files
+# but we can generate one for amd64/x86 now
+if [ -n "${clst_cdtar}" ]
+then
+	extract_cdtar $1
+elif [ "${clst_buildarch}" = "x86" ] || [ "${clst_buildarch}" = "amd64" ]
+then
+	#assume if there is no cdtar and we are on a support arch that the user just wants us to handle this
+	create_bootloader $1
+else
+	#While this seems a little crazy, it's entirely possible the bootloader is just shoved in isoroot overlay
+	echo "No cdtar and unable to auto generate boot loader files... good luck"
+fi
+
 extract_kernels $1/boot
 check_bootargs
 check_filesystem_type
@@ -340,8 +353,10 @@ case ${clst_hostarch} in
 		fi
 
 		# GRUB2
-		if [ -d $1/grub ]
+		if [ -d $1/grub ] || [ -f "$1/boot/EFI/BOOT/BOOTX64.EFI" ]
 		then
+			#the grub dir may not exist, better safe than sorry
+			[ -d "$1/grub" ] || mkdir -p "$1/grub"
 			if [ -e $1/isolinux/isolinux.bin ]
 			then
 				kern_subdir=/isolinux

diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index 2c40f713..607a89aa 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -269,7 +269,7 @@ case ${clst_hostarch} in
 				mkdir -p "${clst_target_path}"/boot
 			else
 				echo "Preparing EFI boot image"
-				# prepare gentoo.efimg from cdtar's /boot/EFI dir
+				# prepare gentoo.efimg from clst_target_path /boot/EFI dir
 				iaSizeTemp=$(du -sk "${clst_target_path}/boot/EFI" 2>/dev/null)
 				iaSizeB=$(echo ${iaSizeTemp} | cut '-d ' -f1)
 				iaSize=$((${iaSizeB}+32)) # Add slack

diff --git a/targets/support/functions.sh b/targets/support/functions.sh
index cca2fd82..8eea1a07 100755
--- a/targets/support/functions.sh
+++ b/targets/support/functions.sh
@@ -53,13 +53,55 @@ extract_cdtar() {
 	# $clst_target_path. We extract the "cdtar" to this directory,
 	# which will normally contains a pre-built binary
 	# boot-loader/filesystem skeleton for the ISO.
-	cdtar=${clst_cdtar}
-	if [ -z "${cdtar}" ]
-	then
-		echo "No cdtar specified. Skipping."
+	tar -I lbzip2 -xpf ${clst_cdtar} -C $1 || die "Couldn't extract cdtar ${cdtar}"
+}
+
+generate_bootloader() {
+	# For amd64 and x86 we attempt to copy boot loader files from the live system and configure it right
+	# this prevents (among other issues) needing to keep a cdtar up to date.  All files are thrown into $clst_target_path
+	# Future improvement may make bootloaders optional, but for now there is only one option
+	if [ "${clst_buildarch}" = "amd64" ]; then
+		if [ -x "/usr/bin/grub2-mkstandalone" ]; then
+			grubmkstndaln="/usr/bin/grub2-mkstandalone"
+		elif [ -x "/usr/bin/grub-mkstandalone" ]; then
+			grubmkstndaln="/usr/bin/grub-mkstandalone"
+		else
+			die "Unable to find grub-mkstandalone\n"
+		fi
+		# while $1/grub is unused here, it triggers grub config building in bootloader-setup.sh
+		mkdir -p "$1/boot/EFI/BOOT" "$1/grub"
+		grub-stub="$(mktemp)"
+		echo "search --no-floppy --set=root --file /livecd" > "${grub-stub}"
+		echo "configfile /grub/grub.cfg" >> "${grub-stub}"
+		${grubmkstndaln} /boot/grub/grub.cfg="${grub-stub}" --compress=xz -O x86_64-efi -o "$1/boot/EFI/BOOT/BOOTX64.EFI" --themes= || die "${grubmkstndaln} failed"
+		rm "${grub-stub}"
+	fi
+
+	mkdir -p "$1/isolinux"
+	echo "Gentoo Linux Installation LiveCD                         http://www.gentoo.org/" > "$1/isolinux/boot.msg"
+	echo "Enter to boot; F1 for kernels  F2 for options." >> "$1/isolinux/boot.msg"
+	echo "Press any key in the next 15 seconds or we'll try to boot from disk." >> "$1/isolinux/boot.msg"
+	if [ -f /usr/share/syslinux/isolinux.bin ]; then
+		cp /usr/share/syslinux/isolinux.bin "$1/isolinux/"
 	else
-		tar -I lbzip2 -xpf ${cdtar} -C $1 || die "Couldn't extract cdtar ${cdtar}"
+		die "Unable to find isolinux.bin, which was requested"
 	fi
+	if [ -f /boot/memtest86plus/memtest ]; then
+		cp /boot/memtest86plus/memtest "$1/isolinux/"
+	else
+		die "Unable to find memtest, which was requested."
+	fi
+	if [ -f "/usr/share/syslinux/hdt.c32" ]; then
+		cp /usr/share/syslinux/hdt.c32 "$1/isolinux/"
+		if [ -f "/usr/share/misc/pci.ids" ]; then
+			cp /usr/share/misc/pci.ids "$1/isolinux/"
+		fi
+	fi
+	for i in libcom32.c32 libutil.c32 ldlinux.c32 reboot.c32 vesamenu.c32; do
+		if [ -f "/usr/share/syslinux/${i}" ]; then
+			cp "/usr/share/syslinux/${i}" "$1/isolinux/"
+		fi
+	done
 }
 
 extract_kernels() {


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

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

commit:     c3419bb48a72395a829b68722f08af135a7473b2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 13 20:18:00 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 13 20:30:58 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=c3419bb4

First shot at sshd image

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

 catalyst/targets/diskimage_stage2.py  |  1 +
 targets/support/diskimagefs-update.sh | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/catalyst/targets/diskimage_stage2.py b/catalyst/targets/diskimage_stage2.py
index bcad8b0d..8fab976d 100644
--- a/catalyst/targets/diskimage_stage2.py
+++ b/catalyst/targets/diskimage_stage2.py
@@ -33,6 +33,7 @@ class diskimage_stage2(StageBase):
         "diskimage/readme",
         "diskimage/rm",
         "diskimage/type",		# generic, cloud-init, ssh, console
+	"diskimage/sshkey",
         "diskimage/unmerge",
         "diskimage/users",
         "diskimage/verify",

diff --git a/targets/support/diskimagefs-update.sh b/targets/support/diskimagefs-update.sh
index 5204a31f..79277618 100755
--- a/targets/support/diskimagefs-update.sh
+++ b/targets/support/diskimagefs-update.sh
@@ -27,6 +27,13 @@ DHCP=yes
 END
 }
 
+configure_sshd() {
+	echo "Configuring sshd"
+	mkdir -vp /root/.ssh
+	chown root:root /root/.ssh
+	echo "${clst_diskimage_sshkey}" > /root/.ssh/authorized_keys
+}
+
 echo "Generating /etc/locale.gen"
 cat > /etc/locale.gen <<END
 en_US ISO-8859-1
@@ -58,6 +65,15 @@ case ${clst_diskimage_type} in
 		systemd-firstboot --timezone=UTC || die "Failed running systemd-firstboot"
 		configure_dhcp
 		;;
+	ssh)
+		echo "Setting up ssh log-in image, using key ${xxx}"
+		echo "Running systemd-firstboot"
+		systemd-firstboot --timezone=UTC || die "Failed running systemd-firstboot"
+		configure_dhcp
+		configure_sshd
+		echo "Adding sshd service"
+		systemctl enable sshd
+		;;
 	*)
 		die "As yet unsupported image type"
 		;;


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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-05 18:19 [gentoo-commits] proj/catalyst:master commit in: targets/support/, catalyst/targets/ Richard Farina
  -- strict thread matches above, loose matches on Subject: below --
2024-10-13 20:33 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