From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1067012-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id A2072138334
	for <garchives@archives.gentoo.org>; Tue, 15 Jan 2019 20:09:48 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 6A310E0A81;
	Tue, 15 Jan 2019 20:09:47 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 34C5FE0A81
	for <gentoo-commits@lists.gentoo.org>; Tue, 15 Jan 2019 20:09:47 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 7FBBB335D11
	for <gentoo-commits@lists.gentoo.org>; Tue, 15 Jan 2019 20:09:43 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 695E4326
	for <gentoo-commits@lists.gentoo.org>; Tue, 15 Jan 2019 20:09:41 +0000 (UTC)
From: "Rick Farina" <zerochaos@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Rick Farina" <zerochaos@gentoo.org>
Message-ID: <1547582928.b53f0734cdaab1411b94210bbfbb88b5bb4a19a0.zerochaos@gentoo>
Subject: [gentoo-commits] proj/catalyst:master commit in: targets/support/
X-VCS-Repository: proj/catalyst
X-VCS-Files: targets/support/bootloader-setup.sh targets/support/create-iso.sh
X-VCS-Directories: targets/support/
X-VCS-Committer: zerochaos
X-VCS-Committer-Name: Rick Farina
X-VCS-Revision: b53f0734cdaab1411b94210bbfbb88b5bb4a19a0
X-VCS-Branch: master
Date: Tue, 15 Jan 2019 20:09:41 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 05952e0d-d569-4af5-8bb4-2a2657932be6
X-Archives-Hash: 9dcab8654b3eee0fbfcdb60d3d7ea494

commit:     b53f0734cdaab1411b94210bbfbb88b5bb4a19a0
Author:     Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 15 20:08:48 2019 +0000
Commit:     Rick Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Tue Jan 15 20:08:48 2019 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=b53f0734

simplify bootloader handling for amd64/x86

remove grub legacy and elilo
keep files in /boot rather than moving them around
simplify create-iso based on the above

Signed-off-by: Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo.org>

 targets/support/bootloader-setup.sh | 137 ++++--------------------------------
 targets/support/create-iso.sh       |  65 ++++++-----------
 2 files changed, 33 insertions(+), 169 deletions(-)

diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh
index b7e2d313..e4735782 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -183,7 +183,6 @@ case ${clst_hostarch} in
 	x86|amd64)
 		if [ -e $1/isolinux/isolinux.bin ]
 		then
-			cp -f $1/boot/* $1/isolinux
 			# the rest of this function sets up the config file for isolinux
 			icfg=$1/isolinux/isolinux.cfg
 			kmsg=$1/isolinux/kernels.msg
@@ -220,26 +219,26 @@ case ${clst_hostarch} in
 					for y in ${clst_kernel_softlevel}
 					do
 						echo "label ${x}-${y}" >> ${icfg}
-						echo "  kernel ${x}" >> ${icfg}
-						echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
+						echo "  kernel /boot/${x}" >> ${icfg}
+						echo "  append ${default_append_line} softlevel=${y} initrd=/boot/${x}.igz vga=791" >> ${icfg}
 
 						echo >> ${icfg}
 						echo "   ${x}" >> ${kmsg}
 						echo "label ${x}-${y}-nofb" >> ${icfg}
-						echo "  kernel ${x}" >> ${icfg}
-						echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz" >> ${icfg}
+						echo "  kernel /boot/${x}" >> ${icfg}
+						echo "  append ${default_append_line} softlevel=${y} initrd=/boot/${x}.igz" >> ${icfg}
 						echo >> ${icfg}
 						echo "   ${x}-nofb" >> ${kmsg}
 					done
 				else
 					echo "label ${x}" >> ${icfg}
-					echo "  kernel ${x}" >> ${icfg}
-					echo "  append ${default_append_line} initrd=${x}.igz vga=791" >> ${icfg}
+					echo "  kernel /boot/${x}" >> ${icfg}
+					echo "  append ${default_append_line} initrd=/boot/${x}.igz vga=791" >> ${icfg}
 					echo >> ${icfg}
 					echo "   ${x}" >> ${kmsg}
 					echo "label ${x}-nofb" >> ${icfg}
-					echo "  kernel ${x}" >> ${icfg}
-					echo "  append ${default_append_line} initrd=${x}.igz" >> ${icfg}
+					echo "  kernel /boot/${x}" >> ${icfg}
+					echo "  append ${default_append_line} initrd=/boot/${x}.igz" >> ${icfg}
 					echo >> ${icfg}
 					echo "   ${x}-nofb" >> ${kmsg}
 				fi
@@ -263,13 +262,6 @@ case ${clst_hostarch} in
 		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
-			else
-				cp -f $1/boot/* $1/grub
-				kern_subdir=/grub
-			fi
 
 			iacfg=$1/grub/grub.cfg
 			echo 'set default=0' > ${iacfg}
@@ -280,122 +272,17 @@ case ${clst_hostarch} in
 			for x in ${clst_boot_kernel}
 			do
 				echo "menuentry 'Boot LiveCD (kernel: ${x})' --class gnu-linux --class os {"  >> ${iacfg}
-				echo "	linux ${kern_subdir}/${x} ${default_append_line}" >> ${iacfg}
-				echo "	initrd ${kern_subdir}/${x}.igz" >> ${iacfg}
+				echo "	linux /boot/${x} ${default_append_line}" >> ${iacfg}
+				echo "	initrd /boot/${x}.igz" >> ${iacfg}
 				echo "}" >> ${iacfg}
 				echo "" >> ${iacfg}
 				echo "menuentry 'Boot LiveCD (kernel: ${x}) (cached)' --class gnu-linux --class os {"  >> ${iacfg}
-				echo "	linux ${kern_subdir}/${x} ${default_append_line} docache" >> ${iacfg}
-				echo "	initrd ${kern_subdir}/${x}.igz" >> ${iacfg}
+				echo "	linux /boot/${x} ${default_append_line} docache" >> ${iacfg}
+				echo "	initrd /boot/${x}.igz" >> ${iacfg}
 				echo "}" >> ${iacfg}
 				echo "" >> ${iacfg}
 			done
 		fi
-
-		if [ -e $1/boot/efi/elilo.efi ]
-		then
-			[ -e $1/isolinux/elilo.efi ] && rm -f $1/isolinux/elilo.efi
-			iacfg=$1/boot/elilo.conf
-			echo 'prompt' > ${iacfg}
-			echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
-			echo 'chooser=simple' >> ${iacfg}
-			echo 'timeout=50' >> ${iacfg}
-			echo >> ${iacfg}
-			for x in ${clst_boot_kernel}
-			do
-				echo "image=/efi/boot/${x}" >> ${iacfg}
-				echo "  label=${x}" >> ${iacfg}
-				echo '  append="'initrd=${x}.igz ${default_append_line}'"' >> ${iacfg}
-				echo "  initrd=/efi/boot/${x}.igz" >> ${iacfg}
-				echo >> ${iacfg}
-				echo "image=/efi/boot/${x}" >> ${iacfg}
-				echo >> ${iacfg}
-				cp -f $1/boot/${x}{,.igz} $1/boot/efi/boot > /dev/null
-				cp -f $1/isolinux/${x}{,.igz} $1/boot/efi/boot > /dev/null
-			done
-			cp ${iacfg} $1/boot/efi/boot
-		fi
-
-		# GRUB legacy (0.97)
-		if [ -e $1/boot/grub/stage2_eltorito ]
-		then
-			icfg=$1/boot/grub/menu.lst
-			echo "default 0" > ${icfg}
-			echo "timeout 15" >> ${icfg}
-			echo "pager on" >> ${icfg}
-
-			# Copy our splash if we're a Gentoo release
-			case ${clst_livecd_type} in
-				gentoo-*)
-					[ -e ${clst_chroot_path}/boot/grub/splash.xpm.gz ] && \
-						cp -f ${clst_chroot_path}/boot/grub/splash.xpm.gz \
-						${1}/boot/grub
-				;;
-			esac
-
-			if [ -e ${1}/boot/grub/splash.xpm.gz ]; then
-				echo "splashimage=/boot/grub/splash.xpm.gz" >> ${icfg}
-			fi
-
-			for x in ${clst_boot_kernel}
-			do
-				eval custom_kopts=\$${x}_kernelopts
-				echo "APPENDING CUSTOM KERNEL ARGS: ${custom_kopts}"
-				echo >> ${icfg}
-
-				eval "clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
-
-				if [ -n "${clst_kernel_softlevel}" ]
-				then
-					for y in ${clst_kernel_softlevel}
-					do
-						echo "title ${x}-${y}" >> ${icfg}
-						echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
-						if [ -e $1/boot/${x}.igz ]
-						then
-							echo "initrd /boot/${x}.igz" >> ${icfg}
-						fi
-						echo >> ${icfg}
-						echo "title ${x}-${y} [ No FrameBuffer ]" >> ${icfg}
-						echo "kernel /boot/${x} softlevel=${y} ${default_append_line}" >> ${icfg}
-						if [ -e $1/boot/${x}.igz ]
-						then
-							echo "initrd /boot/${x}.igz" >> ${icfg}
-						fi
-						echo >> ${icfg}
-					done
-				else
-					echo "title ${x}" >> ${icfg}
-					echo "kernel /boot/${x} ${default_append_line} vga=791" >> ${icfg}
-					if [ -e $1/boot/${x}.igz ]
-					then
-						echo "initrd /boot/${x}.igz" >> ${icfg}
-					fi
-					echo >> ${icfg}
-					echo "title ${x} [ No FrameBuffer ]" >> ${icfg}
-					echo "kernel /boot/${x} ${default_append_line}" >> ${icfg}
-					if [ -e $1/boot/${x}.igz ]
-					then
-						echo "initrd /boot/${x}.igz" >> ${icfg}
-					fi
-				fi
-
-			done
-
-			# Setup help message
-			echo >> ${icfg}
-			echo "title help" >> ${icfg}
-			cp ${clst_sharedir}/livecd/files/README.txt \
-				$1/boot/help.msg
-			echo "cat /boot/help.msg" >> ${icfg}
-
-			if [ -f $1/boot/memtest86 ]
-			then
-				echo >> ${icfg}
-				echo "title memtest86" >> ${icfg}
-				echo "kernel /boot/memtest86" >> ${icfg}
-			fi
-		fi
 	;;
 	mips)
 		# NO SOFTLEVEL SUPPORT YET

diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index 253a8887..1b0f05e1 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -242,16 +242,12 @@ case ${clst_hostarch} in
 			then
 				echo "Found prepared EFI boot image at \
 					${clst_target_path}/gentoo.efimg"
-				# /boot must exist and be empty for later logic
-				echo "Removing /boot contents"
-				rm -rf "${clst_target_path}"/boot
-				mkdir -p "${clst_target_path}"/boot
 			else
 				echo "Preparing EFI boot image"
-        if [ -d "${clst_target_path}/boot/efi" ] && [ ! -d "${clst_target_path}/boot/EFI" ]; then
-          echo "Moving /boot/efi to /boot/EFI"
-          mv "${clst_target_path}/boot/efi" "${clst_target_path}/boot/EFI"
-        fi
+				if [ -d "${clst_target_path}/boot/efi" ] && [ ! -d "${clst_target_path}/boot/EFI" ]; then
+					echo "Moving /boot/efi to /boot/EFI"
+					mv "${clst_target_path}/boot/efi" "${clst_target_path}/boot/EFI"
+				fi
 				# 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)
@@ -276,48 +272,29 @@ case ${clst_hostarch} in
 
 				echo "Copying /boot/EFI to /EFI for rufus compatability"
 				cp -rv "${clst_target_path}"/boot/EFI/ "${clst_target_path}"
-
-				echo "Emptying /boot"
-				rm -rf "${clst_target_path}"/boot
-				mkdir -p "${clst_target_path}"/boot
 			fi
 		fi
 
-		if [ -e "${clst_target_path}/isolinux/isolinux.bin" ]
-		then
-			echo "** Found ISOLINUX bootloader"
-			if [ -d "${clst_target_path}/boot" ]
-			then
-				if [ -n "$(ls ${clst_target_path}/boot)" ]
-				# have stray files in /boot, assume ISOLINUX only
-				then
-					echo "** boot dir not empty, moving files to isolinux/ then removing it"
-					mv "${clst_target_path}"/boot/* "${clst_target_path}/isolinux"
-					rm -r "${clst_target_path}/boot"
-					echo "Creating ISO using ISOLINUX bootloader"
-					run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/
-					isohybrid "${1}"
-				elif [ -e "${clst_target_path}/gentoo.efimg" ]
-				# have BIOS isolinux, plus an EFI loader image
-				then
-					echo "Creating ISO using both ISOLINUX and EFI bootloader"
-					run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -eltorito-platform efi -b gentoo.efimg -no-emul-boot -z "${clst_target_path}"/
-					isohybrid --uefi "${1}"
-				fi
-			else
-				echo "Creating ISO using ISOLINUX bootloader"
-				run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/
-				isohybrid "${1}"
-			fi
-		elif [ -e "${clst_target_path}/boot/grub/stage2_eltorito" ]
-		then
-			echo "Creating ISO using GRUB bootloader"
-			run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b boot/grub/stage2_eltorito -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/
-		elif [ -e "${clst_target_path}/gentoo.efimg" ]
-		then
+		if [ -e "${clst_target_path}/isolinux/isolinux.bin" ]; then
+			echo '** Found ISOLINUX bootloader'
+			if [ -e "${clst_target_path}/gentoo.efimg" ]; then
+			  # have BIOS isolinux, plus an EFI loader image
+			  echo '** Found GRUB2 EFI bootloader'
+				echo 'Creating ISO using both ISOLINUX and EFI bootloader'
+				run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -eltorito-platform efi -b gentoo.efimg -no-emul-boot -z "${clst_target_path}"/
+				isohybrid --uefi "${1}"
+		  else
+			  echo 'Creating ISO using ISOLINUX bootloader'
+			  run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/
+			  isohybrid "${1}"
+		  fi
+		elif [ -e "${clst_target_path}/gentoo.efimg" ]; then
+			echo '** Found GRUB2 EFI bootloader'
 			echo 'Creating ISO using EFI bootloader'
 			run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b gentoo.efimg -c boot.cat -no-emul-boot "${clst_target_path}"/
 		else
+			echo '** Found no known bootloader'
+			echo 'Creating ISO with fingers crossed that you know what you are doing...'
 			run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" "${clst_target_path}"/
 		fi
 	;;