public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/genkernel:master commit in: defaults/, /
@ 2015-04-12 21:04 Mike Frysinger
  0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2015-04-12 21:04 UTC (permalink / raw
  To: gentoo-commits

commit:     8434722d7bfcb4b6d7d6dc7f6f5f6330bbe9289a
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 12 21:03:46 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Apr 12 21:03:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=8434722d

update old cryptsetup-luks references

URL: https://bugs.gentoo.org/504006
Reported-by: e1903131 <AT> drdrb.com

 defaults/initrd.scripts | 2 +-
 gen_cmdline.sh          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 5ef5d0b..153c379 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -826,7 +826,7 @@ startiscsi() {
 
 
 # Open a LUKS device
-# It is either the root or a swap, other devices are supported in the scripts provided with sys-fs/cryptsetup-luks
+# It is either the root or a swap, other devices are supported in the scripts provided with sys-fs/cryptsetup
 # $1 - root/swap
 openLUKS() {
 	# please use 'tr' and this line, or remove it

diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index baa58fa..2678d5d 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -110,7 +110,7 @@ longusage() {
   echo "	--disklabel		Include disk label and uuid support in your ramdisk"
   echo "	--no-disklabel	Exclude disk label and uuid support in your ramdisk"
   echo "	--luks			Include LUKS support"
-  echo "				--> 'emerge cryptsetup-luks' with USE=-dynamic"
+  echo "				--> 'emerge cryptsetup' with USE=static"
   echo "	--no-luks		Exclude LUKS support"
   echo "	--gpg			Include GPG-armored LUKS key support"
   echo "	--no-gpg		Exclude GPG-armored LUKS key support"


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: defaults/, /
@ 2016-01-05 18:51 Richard Farina
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Farina @ 2016-01-05 18:51 UTC (permalink / raw
  To: gentoo-commits

commit:     ed52f905b67f4dc25ec99ae63b68240efb710958
Author:     Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  5 18:49:44 2016 +0000
Commit:     Richard Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Tue Jan  5 18:49:44 2016 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=ed52f905

lvm should not be moved

moving lvm from sbin to bin breaks the symlinks and makes using the
debug shell much harder.  Patch suggested by TomWij and independantly
recreated by Zero_Chaos and ryao.  bug #448156

 defaults/initrd.scripts | 8 ++++----
 gen_initramfs.sh        | 7 ++++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 2612574..1bab361 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -985,15 +985,15 @@ startVolumes() {
 
 	if [ "${USE_LVM_NORMAL}" = '1' ]
 	then
-		if [ -x '/bin/lvm' ]
+		if [ -x '/sbin/lvm' ]
 		then
 			for dev in ${RAID_DEVICES}
 			do
 				setup_md_device "${dev}"
 			done
 
-			# This is needed for /bin/lvm to accept the following logic
-			lvm_commands="#! /bin/lvm"
+			# This is needed for /sbin/lvm to accept the following logic
+			lvm_commands="#! /sbin/lvm"
 
 			# If there is a cahe, update it. Unbreak at least dmcrypt
 			[ -d /etc/lvm/cache ] && lvm_commands="${lvm_commands} \nvgscan"
@@ -1008,7 +1008,7 @@ startVolumes() {
 
 			# And finally execute it all (/proc/... needed if lvm is compiled without readline)
 			good_msg "Scanning for and activating Volume Groups"
-			printf "%b\n" "${lvm_commands}" | /bin/lvm /proc/self/fd/0
+			printf "%b\n" "${lvm_commands}" | /sbin/lvm /proc/self/fd/0
 		else
 			bad_msg "vgscan or vgchange not found: skipping LVM volume group activation!"
 		fi

diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 8fed1eb..9c9dfec 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -339,11 +339,12 @@ append_lvm(){
 	fi
 	cd ${TEMP}
 	mkdir -p "${TEMP}/initramfs-lvm-temp/bin/"
+	mkdir -p "${TEMP}/initramfs-lvm-temp/sbin/"
 	mkdir -p "${TEMP}/initramfs-lvm-temp/etc/lvm/"
 	if false && [ -e '/sbin/lvm.static' ]
 	then
 		print_info 1 '          LVM: Adding support (using local static binary /sbin/lvm.static)...'
-		cp /sbin/lvm.static "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
+		cp /sbin/lvm.static "${TEMP}/initramfs-lvm-temp/sbin/lvm" ||
 			gen_die 'Could not copy over lvm!'
 		# See bug 382555
 		if [ -e '/sbin/dmsetup.static' ]
@@ -353,7 +354,7 @@ append_lvm(){
 	elif false && [ -e '/sbin/lvm' ] && LC_ALL="C" ldd /sbin/lvm|grep -q 'not a dynamic executable'
 	then
 		print_info 1 '          LVM: Adding support (using local static binary /sbin/lvm)...'
-		cp /sbin/lvm "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
+		cp /sbin/lvm "${TEMP}/initramfs-lvm-temp/sbin/lvm" ||
 			gen_die 'Could not copy over lvm!'
 		# See bug 382555
 		if [ -e '/sbin/dmsetup' ] && LC_ALL="C" ldd /sbin/dmsetup | grep -q 'not a dynamic executable'
@@ -365,7 +366,7 @@ append_lvm(){
 		compile_lvm || gen_die "Could not compile LVM"
 		/bin/tar -jxpf "${LVM_BINCACHE}" -C "${TEMP}/initramfs-lvm-temp" ||
 			gen_die "Could not extract lvm binary cache!";
-		mv ${TEMP}/initramfs-lvm-temp/sbin/lvm.static ${TEMP}/initramfs-lvm-temp/bin/lvm ||
+		mv ${TEMP}/initramfs-lvm-temp/sbin/lvm.static ${TEMP}/initramfs-lvm-temp/sbin/lvm ||
 			gen_die 'LVM error: Could not move lvm.static to lvm!'
 		# See bug 382555
 		mv ${TEMP}/initramfs-lvm-temp/sbin/dmsetup.static ${TEMP}/initramfs-lvm-temp/bin/dmsetup ||


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: defaults/, /
@ 2017-01-02 20:14 Matt Thode
  0 siblings, 0 replies; 10+ messages in thread
From: Matt Thode @ 2017-01-02 20:14 UTC (permalink / raw
  To: gentoo-commits

commit:     80524841cdb49683b6af7d49983bca8e9072c037
Author:     Matthew Thode <mthode <AT> mthode <DOT> org>
AuthorDate: Mon Jan  2 20:14:12 2017 +0000
Commit:     Matt Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Mon Jan  2 20:14:12 2017 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=80524841

make nfs togglable fixes musl builds (requires nfs disabled)

 defaults/busy-config | 2 +-
 gen_cmdline.sh       | 4 ++++
 gen_compile.sh       | 4 ++++
 gen_determineargs.sh | 1 +
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/defaults/busy-config b/defaults/busy-config
index 74938c6..9561aa1 100644
--- a/defaults/busy-config
+++ b/defaults/busy-config
@@ -584,7 +584,7 @@ CONFIG_FEATURE_MOUNT_FAKE=y
 CONFIG_FEATURE_MOUNT_VERBOSE=y
 CONFIG_FEATURE_MOUNT_HELPERS=y
 CONFIG_FEATURE_MOUNT_LABEL=y
-CONFIG_FEATURE_MOUNT_NFS=y
+# CONFIG_FEATURE_MOUNT_NFS is not set
 CONFIG_FEATURE_MOUNT_CIFS=y
 CONFIG_FEATURE_MOUNT_FLAGS=y
 CONFIG_FEATURE_MOUNT_FSTAB=y

diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index e9f323c..57a8e1d 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -314,6 +314,10 @@ parse_cmdline() {
 			CMD_BUSYBOX=`parse_optbool "$*"`
 			print_info 2 "CMD_BUSYBOX: ${CMD_BUSYBOX}"
 			;;
+		--nfs|--no-nfs)
+			CMD_NFS=`parse_optbool "$*"`
+			print_info 2 "CMD_NFS: ${CMD_NFS}"
+			;;
 		--unionfs|--no-unionfs)
 			CMD_UNIONFS=`parse_optbool "$*"`
 			print_info 2 "CMD_UNIONFS: ${CMD_UNIONFS}"

diff --git a/gen_compile.sh b/gen_compile.sh
index 2b63f19..70a6732 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -433,6 +433,10 @@ compile_busybox() {
 			gen_die "Busybox directory ${BUSYBOX_DIR} is invalid!"
 		cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
 		cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config.gk_orig"
+		if isTrue "${NFS}"
+		then
+			sed -i 's/.*CONFIG_FEATURE_MOUNT_NFS.*/CONFIG_FEATURE_MOUNT_NFS=y/' "${BUSYBOX_DIR}/.config"
+		fi
 		cd "${BUSYBOX_DIR}"
 		apply_patches busybox ${BUSYBOX_VER}
 		print_info 1 'busybox: >> Configuring...'

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 5402b45..0d908b6 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -116,6 +116,7 @@ determine_real_args() {
 	set_config_with_override BOOL   DMRAID               CMD_DMRAID
 	set_config_with_override BOOL   ISCSI                CMD_ISCSI
 	set_config_with_override BOOL   BUSYBOX              CMD_BUSYBOX              "yes"
+	set_config_with_override BOOL   NFS                  CMD_NFS                  "yes"
 	set_config_with_override BOOL   UNIONFS              CMD_UNIONFS
 	set_config_with_override BOOL   NETBOOT              CMD_NETBOOT
 	set_config_with_override STRING REAL_ROOT            CMD_REAL_ROOT


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: defaults/, /
@ 2019-11-24 20:00 Thomas Deutschmann
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Deutschmann @ 2019-11-24 20:00 UTC (permalink / raw
  To: gentoo-commits

commit:     c016fa911d55334398fc83cf8ca4178c8d77484a
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 20 01:58:00 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Nov 24 19:59:16 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c016fa91

kernel-generic-config: Disable Virtio by default, use --virtio

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/kernel-generic-config | 21 ++-------------------
 gen_configkernel.sh            |  3 +++
 2 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/defaults/kernel-generic-config b/defaults/kernel-generic-config
index c76b175..3e5d589 100644
--- a/defaults/kernel-generic-config
+++ b/defaults/kernel-generic-config
@@ -470,23 +470,8 @@ CONFIG_BLK_DEV_VIA82CXXX=y
 # CONFIG_BLK_DEV_IDEDMA is not set
 # CONFIG_BLK_DEV_HD is not set
 
-CONFIG_VIRTIO=m
-CONFIG_VIRTIO_BLK=m
-CONFIG_VIRTIO_BLK_SCSI=m
-CONFIG_VIRTIO_RING=m
-CONFIG_VIRTIO_PCI=m
-CONFIG_VIRTIO_BALLOON=m
-CONFIG_VIRTIO_NET=m
-CONFIG_VMXNET3=m
-CONFIG_HW_RANDOM_VIRTIO=m
-CONFIG_VIRTIO_CONSOLE=m
-CONFIG_VIRTIO_MMIO=m
-CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
-CONFIG_VIRTIO_VSOCKETS=m
-CONFIG_BLK_MQ_VIRTIO=y
-CONFIG_CRYPTO_DEV_VIRTIO=m
-CONFIG_DRM_VIRTIO_GPU=m
-
+# CONFIG_VIRT_DRIVERS is not set
+# CONFIG_VIRTIO_MENU is not set
 
 #
 # SCSI device support
@@ -946,7 +931,6 @@ CONFIG_RDS_TCP=m
 
 CONFIG_NET_9P=m
 CONFIG_NET_9P_FD=m
-CONFIG_NET_9P_VIRTIO=m
 # CONFIG_NET_9P_DEBUG is not set
 CONFIG_NET_9P_RDMA=m
 
@@ -4529,7 +4513,6 @@ CONFIG_IXGBEVF=m
 CONFIG_IXGBE_HWMON=y
 CONFIG_IXGBE_PTP=y
 CONFIG_VMWARE_PVSCSI=m
-CONFIG_SCSI_VIRTIO=m
 CONFIG_SCSI_PM8001=m
 CONFIG_MACVTAP=m
 CONFIG_SND_HDA_PREALLOC_SIZE=512

diff --git a/gen_configkernel.sh b/gen_configkernel.sh
index d95368f..6141ba6 100755
--- a/gen_configkernel.sh
+++ b/gen_configkernel.sh
@@ -749,6 +749,9 @@ config_kernel() {
 		kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_VIRTIO_MMIO" "${newvirtio_setting}"
 		kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES" "y"
 
+		kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_NET_9P" "${newvirtio_setting}"
+		kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_NET_9P_VIRTIO" "${newvirtio_setting}"
+
 		if [ ${KV_NUMERIC} -ge 4008 ]
 		then
 			local cfg_CONFIG_VSOCKETS=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_VSOCKETS")


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: defaults/, /
@ 2020-01-12 14:59 Thomas Deutschmann
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Deutschmann @ 2020-01-12 14:59 UTC (permalink / raw
  To: gentoo-commits

commit:     9e7b41cda3df648b509a0f8a2af29a683100a46f
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 10 16:07:20 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sat Jan 11 19:54:40 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=9e7b41cd

Rework ZFS unlock

- Prompt for key when key is unavailable, not when key is available.

- Check ZFS' keystatus property instead of return value to allow
  remote unlock.

- Add unlock-zfs command to remote rescue shell.

Closes: https://bugs.gentoo.org/705032
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/initrd.defaults |  3 ++
 defaults/initrd.scripts  | 38 +++++++++++++++-----
 defaults/linuxrc         | 42 +++++++++++++++-------
 defaults/login-remote.sh |  5 +++
 defaults/unlock-zfs.sh   | 91 ++++++++++++++++++++++++++++++++++++++++++++++++
 gen_initramfs.sh         |  6 ++++
 6 files changed, 165 insertions(+), 20 deletions(-)

diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
index 198800b..15326dd 100644
--- a/defaults/initrd.defaults
+++ b/defaults/initrd.defaults
@@ -103,6 +103,9 @@ CRYPT_KEYFILE_SWAP='/tmp/swap.key'
 CRYPT_ROOT_OPENED_LOCKFILE='/tmp/ROOT.opened'
 CRYPT_SWAP_OPENED_LOCKFILE='/tmp/SWAP.opened'
 
+ZFS_ENC_ENV_FILE='/etc/ZFS_ENC_ENV.conf'
+ZFS_ENC_OPENED_LOCKFILE='/tmp/ZFS.opened'
+
 # Flag for if ok when using CDROOT
 got_good_root='0'
 # if LOOP found on root before mount, trigger Unpacking additional packages

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 73cd94c..6c7d72b 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1087,6 +1087,20 @@ warn_msg() {
 	[ "$2" != '1' ] && printf "%b\n" "${WARN}**${NORMAL}${BOLD} ${msg_string} ${NORMAL}"
 }
 
+write_env_file() {
+	local env_file=${1}
+	shift
+
+	run touch "${env_file}"
+
+	local varname= varvalue=
+	for varname in $*
+	do
+		eval varvalue=\$${varname}
+		echo "${varname}=${varvalue}" >> "${env_file}"
+	done
+}
+
 crypt_filter() {
 	if [ "${CRYPT_SILENT}" = '1' ]
 	then
@@ -2265,14 +2279,15 @@ start_sshd() {
 		return
 	fi
 
-	# setup environment variables for the ssh login shell
-	local varname= varvalue=
-	run touch "${CRYPT_ENV_FILE}"
-	for varname in CRYPT_ROOT CRYPT_ROOT_TRIM CRYPT_SILENT CRYPT_SWAP
-	do
-		eval varvalue=\$${varname}
-		echo "${varname}=${varvalue}" >> "${CRYPT_ENV_FILE}"
-	done
+	# setup environment variables for the remote rescue shell
+	# ZFS will use a different file because $REAL_ROOT for ZFS
+	# isn't known yet.
+	write_env_file \
+		"${CRYPT_ENV_FILE}" \
+		CRYPT_ROOT \
+		CRYPT_ROOT_TRIM \
+		CRYPT_SILENT \
+		CRYPT_SWAP
 
 	run touch /var/log/lastlog
 
@@ -2679,6 +2694,13 @@ get_mount_device() {
 		' ${NEW_ROOT}/etc/fstab
 }
 
+get_zfs_property() {
+	local device=${1}
+	local propertyname=${2}
+
+	echo "$(zfs get -H -o value ${propertyname} "${device}" 2>/dev/null)"
+}
+
 # If the kernel is handed a mount option is does not recognize, it WILL fail to
 # mount. util-linux handles auto/noauto, but busybox passes it straight to the kernel
 # which then rejects the mount.

diff --git a/defaults/linuxrc b/defaults/linuxrc
index f585017..7fbd0ad 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -491,7 +491,7 @@ then
 		if [ ! -x ${i} ]
 		then
 			USE_ZFS=0
-			bad_msg 'Aborting use of zfs because ${i} not found!'
+			bad_msg "Aborting use of ZFS because ${i} not found!"
 			break
 		fi
 	done
@@ -740,7 +740,7 @@ do
 					ROOT_DEV="${REAL_ROOT#*=}"
 					if [ "${ROOT_DEV}" != 'ZFS' ]
 					then
-						if [ "$(zfs get type -o value -H ${ROOT_DEV} 2>/dev/null)" = 'filesystem' ]
+						if [ "$(get_zfs_property "${ROOT_DEV}" type)" = 'filesystem' ]
 						then
 							got_good_root=1
 							REAL_ROOT=${ROOT_DEV}
@@ -753,7 +753,7 @@ do
 							continue
 						fi
 					else
-						BOOTFS=$(/sbin/zpool list -H -o bootfs 2>/dev/null)
+						BOOTFS=$(zpool list -H -o bootfs 2>/dev/null)
 						if [ "${BOOTFS}" != '-' ]
 						then
 							for i in ${BOOTFS}
@@ -801,6 +801,14 @@ do
 			echo
 		fi
 
+		if [ "${USE_ZFS}" = '1' ]
+		then
+			write_env_file \
+				"${ZFS_ENC_ENV_FILE}" \
+				REAL_ROOT \
+				ROOTFSTYPE
+		fi
+
 		# Check for a block device or /dev/nfs or zfs encryption
 		if [ -n "${REAL_ROOT}" ] && [ "${REAL_ROOT}" = "/dev/nfs" ] || [ "${ROOTFSTYPE}" = "zfs" ] || [ -b "${REAL_ROOT}" ]
 		then
@@ -810,20 +818,30 @@ do
 				# let's check if this dataset is encrypted and ask for passphrase
 				if [ "$(zpool list -H -o feature@encryption "${REAL_ROOT%%/*}" 2>/dev/null)" = 'active' ]
 				then
-					ZFS_KEYSTATUS="$(zfs get -H -o value keystatus "${REAL_ROOT}" 2>/dev/null)"
-					ZFS_ENCRYPTIONROOT="$(zfs get -H -o value encryptionroot "${REAL_ROOT}" 2>/dev/null)"
-					if ! [ "${ZFS_ENCRYPTIONROOT}" = '-' ] || [ "${ZFS_KEYSTATUS}" = 'available' ]
+					ZFS_KEYSTATUS="$(get_zfs_property "${REAL_ROOT}" keystatus)"
+					ZFS_ENCRYPTIONROOT="$(get_zfs_property "${REAL_ROOT}" encryptionroot)"
+					if [ "${ZFS_ENCRYPTIONROOT}" != '-' ] && [ "${ZFS_KEYSTATUS}" = 'unavailable' ]
 					then
 						good_msg "Detected ZFS encryption, asking for key"
-						zfs load-key "${ZFS_ENCRYPTIONROOT}"
-						retval=$?
-						# if the key loaded fine, confirm got_good_root to exit second while loop
-						if [ ${retval} -ne 0 ]
+						run zfs load-key "${ZFS_ENCRYPTIONROOT}"
+
+						# Get new key status to check if load-key was successful
+						# or dataset has been opened by someone else in the meantime (through SSH for instance)
+						ZFS_KEYSTATUS="$(get_zfs_property "${REAL_ROOT}" keystatus)"
+
+						if [ "${ZFS_KEYSTATUS}" != 'available' ]
 						then
-							bad_msg "${ROOT_DEV} is encrypted and not mountable without key"
+							bad_msg "${REAL_ROOT} is encrypted and not mountable without key"
 							got_good_root=0
 							break
 						fi
+
+						if [ -f "${ZFS_ENC_OPENED_LOCKFILE}" ]
+						then
+							good_msg "${REAL_ROOT} device meanwhile was opened by someone else."
+						else
+							run touch "${ZFS_ENC_OPENED_LOCKFILE}"
+						fi
 					fi
 				fi
 			else
@@ -849,7 +867,7 @@ do
 
 		if [ "${ROOTFSTYPE}" = 'zfs' ]
 		then
-			if [ "$(zfs get -H -o value mountpoint "${REAL_ROOT}")" = 'legacy' ]
+			if [ "$(get_zfs_property "${REAL_ROOT}" mountpoint)" = 'legacy' ]
 			then
 				MOUNT_STATE=rw
 			else

diff --git a/defaults/login-remote.sh b/defaults/login-remote.sh
index 588504f..94ee014 100644
--- a/defaults/login-remote.sh
+++ b/defaults/login-remote.sh
@@ -105,6 +105,11 @@ else
 		good_msg "${NORMAL}To remote unlock LUKS-encrypted swap device, run '${BOLD}unlock-luks swap${NORMAL}'."
 	fi
 
+	if [ -e "${ZFS_ENC_ENV_FILE}" ] && [ ! -f "${ZFS_ENC_OPENED_LOCKFILE}" ]
+	then
+		good_msg "${NORMAL}To remote unlock ZFS root device, run '${BOLD}unlock-zfs${NORMAL}'."
+	fi
+
 	echo
 
 	[ -x /bin/sh ] && SH=/bin/sh || SH=/bin/ash

diff --git a/defaults/unlock-zfs.sh b/defaults/unlock-zfs.sh
new file mode 100644
index 0000000..c22a214
--- /dev/null
+++ b/defaults/unlock-zfs.sh
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+. /etc/initrd.defaults
+. /etc/initrd.scripts
+
+GK_INIT_LOG_PREFIX=${0}
+if [ -n "${SSH_CLIENT_IP}" ] && [ -n "${SSH_CLIENT_PORT}" ]
+then
+	GK_INIT_LOG_PREFIX="${0}[${SSH_CLIENT_IP}:${SSH_CLIENT_PORT}]"
+fi
+
+if [ -f "${ZFS_ENC_ENV_FILE}" ]
+then
+	. "${ZFS_ENC_ENV_FILE}"
+else
+	bad_msg "${ZFS_ENC_ENV_FILE} does not exist! Did you boot without 'dozfs' kernel command-line parameter?"
+	exit 1
+fi
+
+main() {
+	if ! hash zfs >/dev/null 2>&1
+	then
+		bad_msg "zfs program is missing. Was initramfs built without --zfs parameter?"
+		exit 1
+	elif ! hash zpool >/dev/null 2>&1
+	then
+		bad_msg "zpool program is missing. Was initramfs built without --zfs parameter?"
+		exit 1
+	elif [ -z "${ROOTFSTYPE}" ]
+	then
+		bad_msg "Something went wrong. ROOTFSTYPE is not set!"
+		exit 1
+	elif [ "${ROOTFSTYPE}" != "zfs" ]
+	then
+		bad_msg "ROOTFSTYPE of 'zfs' required but '${ROOTFSTYPE}' detected!"
+		exit 1
+	elif [ -z "${REAL_ROOT}" ]
+	then
+		bad_msg "Something went wrong. REAL_ROOT is not set!"
+		exit 1
+	fi
+
+	if [ "$(zpool list -H -o feature@encryption "${REAL_ROOT%%/*}" 2>/dev/null)" != 'active' ]
+	then
+		bad_msg "Root device ${REAL_ROOT} is not encrypted!"
+		exit 1
+	fi
+
+	local ZFS_ENCRYPTIONROOT="$(get_zfs_property "${REAL_ROOT}" encryptionroot)"
+	if [ "${ZFS_ENCRYPTIONROOT}" = '-' ]
+	then
+		bad_msg "Failed to determine encryptionroot for ${REAL_ROOT}!"
+		exit 1
+	fi
+
+	local ZFS_KEYSTATUS=
+	while true
+	do
+		if [ -e "${ZFS_ENC_OPENED_LOCKFILE}" ]
+		then
+			good_msg "${REAL_ROOT} device meanwhile was opened by someone else."
+			break
+		fi
+
+		zfs load-key "${ZFS_ENCRYPTIONROOT}"
+
+		ZFS_KEYSTATUS="$(get_zfs_property "${REAL_ROOT}" keystatus)"
+		if [ "${ZFS_KEYSTATUS}" = 'available' ]
+		then
+			run touch "${ZFS_ENC_OPENED_LOCKFILE}"
+			good_msg "ZFS device ${REAL_ROOT} opened"
+			break
+		else
+			bad_msg "Failed to open ZFS device ${REAL_ROOT}"
+
+			# We need to stop here with a non-zero exit code to prevent
+			# a loop when invalid keyfile was sent.
+			exit 1
+		fi
+	done
+
+	if [ "${ZFS_KEYSTATUS}" = 'available' ]
+	then
+		# Kill any running load-key prompt.
+		run pkill -f "load-key" >/dev/null 2>&1
+	fi
+}
+
+main
+
+exit 0

diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 676b86d..8620414 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -1342,6 +1342,9 @@ append_dropbear() {
 	cp -a "${GK_SHARE}"/defaults/unlock-luks.sh "${TDIR}"/usr/sbin/unlock-luks \
 		|| gen_die "Failed to copy '${GK_SHARE}/defaults/unlock-luks.sh' to '${TDIR}/usr/sbin/unlock-luks'"
 
+	cp -a "${GK_SHARE}"/defaults/unlock-zfs.sh "${TDIR}"/usr/sbin/unlock-zfs \
+		|| gen_die "Failed to copy '${GK_SHARE}/defaults/unlock-zfs.sh' to '${TDIR}/usr/sbin/unlock-zfs'"
+
 	cp -aL "${DROPBEAR_AUTHORIZED_KEYS_FILE}" "${TDIR}"/root/.ssh/ \
 		|| gen_die "Failed to copy '${DROPBEAR_AUTHORIZED_KEYS_FILE}'!"
 
@@ -1369,6 +1372,9 @@ append_dropbear() {
 	chmod 0755 "${TDIR}"/usr/sbin/unlock-luks \
 		|| gen_die "Failed to chmod of '${TDIR}/usr/sbin/unlock-luks'!"
 
+	chmod 0755 "${TDIR}"/usr/sbin/unlock-zfs \
+		|| gen_die "Failed to chmod of '${TDIR}/usr/sbin/unlock-zfs'!"
+
 	chmod 0640 "${TDIR}"/etc/shadow \
 		|| gen_die "Failed to chmod of '${TDIR}/etc/shadow'!"
 


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: defaults/, /
@ 2020-07-16 15:03 Thomas Deutschmann
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Deutschmann @ 2020-07-16 15:03 UTC (permalink / raw
  To: gentoo-commits

commit:     cc875f5163a6e79110e4afcabe07acdacd369bf5
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 15:00:21 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Thu Jul 16 14:29:16 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=cc875f51

gen_determineargs.sh: determine_real_args(): Don't call gcc directly

Set $CHOST variable via config so that we no longer need to call
gcc directly to determine CHOST value.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/config.sh   |  3 +++
 gen_determineargs.sh | 13 ++++++-------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/defaults/config.sh b/defaults/config.sh
index bab7b7e..f8cb311 100644
--- a/defaults/config.sh
+++ b/defaults/config.sh
@@ -49,3 +49,6 @@ DEFAULT_UTILS_CC=gcc
 DEFAULT_UTILS_CXX=g++
 DEFAULT_UTILS_AS=as
 DEFAULT_UTILS_LD=ld
+
+PORTAGE_CHOST="$(portageq envvar CHOST)"
+DEFAULT_CHOST="${PORTAGE_CHOST:-$(${DEFAULT_UTILS_CC} -dumpmachine 2>/dev/null)}"

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 956e3bf..b464505 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -300,6 +300,7 @@ determine_real_args() {
 
 	set_config_with_override STRING COMPRESS_INITRD                       CMD_COMPRESS_INITRD                       "${DEFAULT_COMPRESS_INITRD}"
 	set_config_with_override STRING COMPRESS_INITRD_TYPE                  CMD_COMPRESS_INITRD_TYPE                  "${DEFAULT_COMPRESS_INITRD_TYPE}"
+	set_config_with_override STRING CHOST                                 CMD_CHOST                                 "${DEFAULT_CHOST}"
 	set_config_with_override STRING MAKEOPTS                              CMD_MAKEOPTS                              "${DEFAULT_MAKEOPTS}"
 	set_config_with_override STRING NICE                                  CMD_NICE                                  "10"
 	set_config_with_override STRING KERNEL_MAKE                           CMD_KERNEL_MAKE                           "${DEFAULT_KERNEL_MAKE}"
@@ -563,17 +564,15 @@ determine_real_args() {
 	ARCH_CONFIG="${GK_SHARE}/arch/${ARCH}/config.sh"
 	[ -f "${ARCH_CONFIG}" ] || gen_die "${ARCH} not yet supported by genkernel. Please add the arch-specific config file '${ARCH_CONFIG}'!"
 
-	# set CBUILD and CHOST
-	local build_cc=$(tc-getBUILD_CC)
-	CBUILD=$(${build_cc} -dumpmachine 2>/dev/null)
-	if [ -z "${CBUILD}" ]
+	# Set CBUILD and CHOST
+	if ! isTrue "$(is_valid_triplet "${CHOST}")"
 	then
-		gen_die "Failed to determine CBUILD using '${build_cc} -dumpmachine' command!"
+		gen_die "Set CHOST '${CHOST}' does NOT represent a valid triplet!"
 	else
+		# Initialize CBUILD with CHOST value
+		CBUILD=${CHOST}
 		print_info 5 "CBUILD set to '${CBUILD}' ..."
-		CHOST="${CBUILD}"
 	fi
-	unset build_cc
 
 	if [ -n "${CMD_CROSS_COMPILE}" ]
 	then


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: defaults/, /
@ 2020-07-23 23:57 Thomas Deutschmann
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Deutschmann @ 2020-07-23 23:57 UTC (permalink / raw
  To: gentoo-commits

commit:     17cdd9c8ca954c180a216b9e33cf8de7be5f4a43
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 23 21:05:18 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Thu Jul 23 22:56:48 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=17cdd9c8

dmraid: Switch to UDEV usage

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/initrd.scripts | 18 +++++++++---------
 defaults/software.sh    |  2 +-
 gen_initramfs.sh        |  2 ++
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 7d852ee..d2db059 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1548,10 +1548,12 @@ start_volumes() {
 
 	if [ "${USE_DMRAID_NORMAL}" = '1' ]
 	then
-		if [ -x '/sbin/dmraid' ]
+		if ! hash dmraid >/dev/null 2>&1
 		then
+			bad_msg "dodmraid invoked but 'dmraid' not found; Skipping dmraid activation ..."
+		else
 			good_msg "Activating Device-Mapper RAID(s) ..."
-			local dmraid_cmd="run /sbin/dmraid -ay"
+			local dmraid_cmd="run dmraid -ay"
 			if [ -z "${DMRAID_OPTS}" ]
 			then
 				dmraid_cmd="${dmraid_cmd} 2>&1"
@@ -1559,16 +1561,14 @@ start_volumes() {
 				dmraid_cmd="${dmraid_cmd} ${DMRAID_OPTS} 2>&1"
 			fi
 			is_log_enabled && dmraid_cmd="${dmraid_cmd} | tee -a '${GK_INIT_LOG}'"
-			eval "${dmraid_cmd}"
 
-			if [ -x '/sbin/kpartx' ]
+			eval "${dmraid_cmd}"
+			if [ $? -ne 0 ]
 			then
-				dmraid_cmd="run /sbin/dmsetup ls --exec '/sbin/kpartx -a -s' 2>&1"
-				is_log_enabled && dmraid_cmd="${dmraid_cmd} | tee -a '${GK_INIT_LOG}'"
-				eval "${dmraid_cmd}"
+				bad_msg "Activation of Device-Mapper RAID(s) failed!"
+			else
+				udevsettle
 			fi
-		else
-			bad_msg "dodmraid invoked but /sbin/dmraid not found; Skipping dmraid activation ..."
 		fi
 	fi
 

diff --git a/defaults/software.sh b/defaults/software.sh
index ae7532f..d8dbfc9 100644
--- a/defaults/software.sh
+++ b/defaults/software.sh
@@ -60,7 +60,7 @@ GKPKG_CRYPTSETUP_BINPKG="${GKPKG_CRYPTSETUP_BINPKG:-%%CACHE%%/cryptsetup-${GKPKG
 
 GKPKG_DMRAID_PN="dmraid"
 GKPKG_DMRAID_PV="${GKPKG_DMRAID_PV:-VERSION_DMRAID}"
-GKPKG_DMRAID_DEPS="lvm"
+GKPKG_DMRAID_DEPS="eudev lvm"
 GKPKG_DMRAID_SRCTAR="${GKPKG_DMRAID_SRCTAR:-${DISTDIR}/dmraid-${GKPKG_DMRAID_PV}.tar.bz2}"
 GKPKG_DMRAID_SRCDIR="${GKPKG_DMRAID_SRCDIR:-dmraid/${GKPKG_DMRAID_PV}/dmraid}"
 GKPKG_DMRAID_BINPKG="${GKPKG_DMRAID_BINPKG:-%%CACHE%%/dmraid-${GKPKG_DMRAID_PV}-%%ARCH%%.tar.xz}"

diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 1b8c829..24b23bb 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -775,6 +775,8 @@ append_dmraid() {
 
 	unpack "$(get_gkpkg_binpkg "${PN}")" "${TDIR}"
 
+	mkdir -p "${TDIR}"/run/lock/dmraid || gen_die "Failed to create '${TDIR}/run/lock/dmraid'!"
+
 	cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
 
 	# Delete unneeded files


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: defaults/, /
@ 2020-08-01 21:41 Thomas Deutschmann
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Deutschmann @ 2020-08-01 21:41 UTC (permalink / raw
  To: gentoo-commits

commit:     9f540e262f18abdfde67d63a7d87da04abc322c8
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  1 13:55:57 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sat Aug  1 20:35:00 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=9f540e26

Unify grep usage

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 Makefile                | 4 ++--
 defaults/initrd.scripts | 2 +-
 defaults/linuxrc        | 4 ++--
 gen_determineargs.sh    | 4 ++--
 gen_funcs.sh            | 4 ++--
 gen_initramfs.sh        | 2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index e423ab0..92d1278 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-#PACKAGE_VERSION = $(shell /bin/fgrep GK_V= genkernel | sed "s/.*GK_V='\([^']\+\)'/\1/")
+#PACKAGE_VERSION = $(shell /bin/grep -F -- GK_V= genkernel | sed "s/.*GK_V='\([^']\+\)'/\1/")
 PACKAGE_VERSION = $(shell git describe --tags |sed 's,^v,,g')
 distdir = genkernel-$(PACKAGE_VERSION)
 MANPAGE = genkernel.8
@@ -78,7 +78,7 @@ verify-doc: doc/genkernel.8.txt
 			-e '/ssh-host-keys/s,=\(create\|create-from-host\|runtime\),,g' | \
 		while read opt ; do \
 			regex="^*--(...no-...)?$$opt" ; \
-			if ! egrep -e "$$regex" $< -sq ; then \
+			if ! grep -Ee "$$regex" $< -sq ; then \
 				touch faildoc ; \
 				echo "Undocumented option: $$opt" ; \
 			fi ; \

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 304d634..22d7e85 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1023,7 +1023,7 @@ run_shell() {
 
 fs_type_in_use() {
 	fs_type=$1
-	cut -d ' ' -f 3 < /proc/mounts | fgrep -q "${fs_type}"
+	cut -d ' ' -f 3 < /proc/mounts | grep -Fq "${fs_type}"
 }
 
 mount_devfs() {

diff --git a/defaults/linuxrc b/defaults/linuxrc
index e9e97b6..3ca7e86 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -1062,7 +1062,7 @@ then
 					bad_msg "Squashfs filesystem could not be mounted, dropping into shell."
 					if [ -e /proc/filesystems ]
 					then
-						fgrep -q squashfs /proc/filesystems || \
+						grep -Fq squashfs /proc/filesystems || \
 							bad_msg "HINT: Your kernel does not know filesystem \"squashfs\"."
 					fi
 					run_shell
@@ -1279,7 +1279,7 @@ do
 	# and not a mountpoint
 	[ -z "${dev}" ] && continue
 	fstype=$(get_mount_fstype ${fs})
-	if get_mount_options ${fs} | fgrep -q bind
+	if get_mount_options ${fs} | grep -Fq bind
 	then
 		opts='bind'
 		dev=${NEW_ROOT}${dev}

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index d8f3028..75dc151 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -606,7 +606,7 @@ determine_real_args() {
 	vars_to_initialize+=( "BUSYBOX_CONFIG" )
 	vars_to_initialize+=( "DEFAULT_KERNEL_CONFIG" )
 
-	local binpkgs=( $(compgen -A variable |grep '^GKPKG_.*_BINPKG$') )
+	local binpkgs=( $(compgen -A variable | grep '^GKPKG_.*_BINPKG$') )
 	local binpkg
 	for binpkg in "${binpkgs[@]}"
 	do
@@ -639,7 +639,7 @@ determine_real_args() {
 	declare -gA GKICM_LOOKUP_TABLE_PKG=()
 	local known_initramfs_compression_methods_by_compression=( $(get_initramfs_compression_method_by_compression) )
 	local known_initramfs_compression_methods_by_speed=( $(get_initramfs_compression_method_by_speed) )
-	local initramfs_compression_methods=( $(compgen -A variable |grep '^GKICM_.*_KOPTNAME$') )
+	local initramfs_compression_methods=( $(compgen -A variable | grep '^GKICM_.*_KOPTNAME$') )
 	local initramfs_compression_method key var_name var_prefix
 	for initramfs_compression_method in "${initramfs_compression_methods[@]}"
 	do

diff --git a/gen_funcs.sh b/gen_funcs.sh
index f2f075a..0eea8ee 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -1908,7 +1908,7 @@ check_disk_space_requirements() {
 }
 
 check_distfiles() {
-	local source_files=( $(compgen -A variable |grep '^GKPKG_.*_SRCTAR$') )
+	local source_files=( $(compgen -A variable | grep '^GKPKG_.*_SRCTAR$') )
 
 	local -a missing_sources
 	local source_file=
@@ -2046,7 +2046,7 @@ make_bootdir_writable() {
 	local bootdir_status=unknown
 
 	# Based on mount-boot.eclass code
-	local fstabstate=$(awk "!/^#|^[[:blank:]]+#|^${BOOTDIR//\//\\/}/ {print \$2}" /etc/fstab 2>/dev/null | egrep "^${BOOTDIR}$" )
+	local fstabstate=$(awk "!/^#|^[[:blank:]]+#|^${BOOTDIR//\//\\/}/ {print \$2}" /etc/fstab 2>/dev/null | grep -E "^${BOOTDIR}$" )
 	local procstate=$(awk "\$2 ~ /^${BOOTDIR//\//\\/}\$/ {print \$2}" /proc/mounts 2>/dev/null)
 	local proc_ro=$(awk '{ print $2 " ," $4 "," }' /proc/mounts 2>/dev/null | sed -n "/^${BOOTDIR//\//\\/} .*,ro,/p")
 

diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index e48fa06..c583318 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -37,7 +37,7 @@ copy_binaries() {
 		[[ -e "${binary}" ]] \
 			|| gen_die "Binary ${binary} could not be found"
 
-		if LC_ALL=C "${LDDTREE_COMMAND}" "${binary}" 2>&1 | fgrep -q 'not found'
+		if LC_ALL=C "${LDDTREE_COMMAND}" "${binary}" 2>&1 | grep -F -q 'not found'
 		then
 			gen_die "Binary ${binary} is linked to missing libraries and may need to be re-built"
 		fi


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: defaults/, /
@ 2020-08-28 20:18 Thomas Deutschmann
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Deutschmann @ 2020-08-28 20:18 UTC (permalink / raw
  To: gentoo-commits

commit:     6ea3cd1f1525fdadb9faabfe8183e22b4836acdf
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 27 20:55:56 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Aug 28 13:45:21 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=6ea3cd1f

defaults/config.sh: Add DEFAULT_<TYPE>_<TCVAR> to allow override

_tc-getPROG() can only override variable with user provided value
when there is a default value.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/config.sh   | 26 ++++++++++++++++++++------
 gen_determineargs.sh | 26 +++++++++++++++++++++-----
 2 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/defaults/config.sh b/defaults/config.sh
index f8cb311..a5d9ea3 100644
--- a/defaults/config.sh
+++ b/defaults/config.sh
@@ -37,18 +37,32 @@ DEFAULT_MAKEOPTS="${PORTAGE_MAKEOPTS:- -j$(nproc)}"
 
 DEFAULT_MODULEREBUILD_CMD="emerge --ignore-default-opts --buildpkg=n --usepkg=n --quiet-build=y @module-rebuild"
 
-DEFAULT_KERNEL_MAKE=make
-DEFAULT_UTILS_MAKE=make
-
-DEFAULT_KERNEL_CC=gcc
 DEFAULT_KERNEL_AS=as
+DEFAULT_KERNEL_AR=ar
+DEFAULT_KERNEL_CC=gcc
+DEFAULT_KERNEL_CXX=g++
 DEFAULT_KERNEL_LD=ld
+DEFAULT_KERNEL_NM=nm
+DEFAULT_KERNEL_MAKE=make
+DEFAULT_KERNEL_OBJCOPY=objcopy
+DEFAULT_KERNEL_OBJDUMP=objdump
+DEFAULT_KERNEL_RANLIB=ranlib
+DEFAULT_KERNEL_READELF=readelf
+DEFAULT_KERNEL_STRIP=strip
 
-DEFAULT_UTILS_CFLAGS="-Os -pipe -fomit-frame-pointer"
+DEFAULT_UTILS_AS=as
+DEFAULT_UTILS_AR=ar
 DEFAULT_UTILS_CC=gcc
+DEFAULT_UTILS_CFLAGS="-Os -pipe -fomit-frame-pointer"
 DEFAULT_UTILS_CXX=g++
-DEFAULT_UTILS_AS=as
 DEFAULT_UTILS_LD=ld
+DEFAULT_UTILS_NM=nm
+DEFAULT_UTILS_MAKE=make
+DEFAULT_UTILS_OBJCOPY=objcopy
+DEFAULT_UTILS_OBJDUMP=objdump
+DEFAULT_UTILS_RANLIB=ranlib
+DEFAULT_UTILS_READELF=readelf
+DEFAULT_UTILS_STRIP=strip
 
 PORTAGE_CHOST="$(portageq envvar CHOST)"
 DEFAULT_CHOST="${PORTAGE_CHOST:-$(${DEFAULT_UTILS_CC} -dumpmachine 2>/dev/null)}"

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 7332bb0..0fe8886 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -318,16 +318,32 @@ determine_real_args() {
 	set_config_with_override STRING CHOST                                 CMD_CHOST                                 "${DEFAULT_CHOST}"
 	set_config_with_override STRING MAKEOPTS                              CMD_MAKEOPTS                              "${DEFAULT_MAKEOPTS}"
 	set_config_with_override STRING NICE                                  CMD_NICE                                  "10"
-	set_config_with_override STRING KERNEL_MAKE                           CMD_KERNEL_MAKE                           "${DEFAULT_KERNEL_MAKE}"
-	set_config_with_override STRING UTILS_CFLAGS                          CMD_UTILS_CFLAGS                          "${DEFAULT_UTILS_CFLAGS}"
-	set_config_with_override STRING UTILS_MAKE                            CMD_UTILS_MAKE                            "${DEFAULT_UTILS_MAKE}"
+	set_config_with_override STRING KERNEL_AS                             CMD_KERNEL_AS                             "${DEFAULT_KERNEL_AS}"
+	set_config_with_override STRING KERNEL_AR                             CMD_KERNEL_AR                             "${DEFAULT_KERNEL_AR}"
 	set_config_with_override STRING KERNEL_CC                             CMD_KERNEL_CC                             "${DEFAULT_KERNEL_CC}"
+	set_config_with_override STRING KERNEL_CFLAGS                         CMD_KERNEL_CFLAGS                         "${DEFAULT_KERNEL_CFLAGS}"
+	set_config_with_override STRING KERNEL_CXX                            CMD_KERNEL_CXX                            "${DEFAULT_KERNEL_CXX}"
 	set_config_with_override STRING KERNEL_LD                             CMD_KERNEL_LD                             "${DEFAULT_KERNEL_LD}"
-	set_config_with_override STRING KERNEL_AS                             CMD_KERNEL_AS                             "${DEFAULT_KERNEL_AS}"
+	set_config_with_override STRING KERNEL_NM                             CMD_KERNEL_NM                             "${DEFAULT_KERNEL_NM}"
+	set_config_with_override STRING KERNEL_MAKE                           CMD_KERNEL_MAKE                           "${DEFAULT_KERNEL_MAKE}"
+	set_config_with_override STRING KERNEL_OBJCOPY                        CMD_KERNEL_OBJCOPY                        "${DEFAULT_KERNEL_OBJCOPY}"
+	set_config_with_override STRING KERNEL_OBJDUMP                        CMD_KERNEL_OBJDUMP                        "${DEFAULT_KERNEL_OBJDUMP}"
+	set_config_with_override STRING KERNEL_RANLIB                         CMD_KERNEL_RANLIB                         "${DEFAULT_KERNEL_RANLIB}"
+	set_config_with_override STRING KERNEL_READELF                        CMD_KERNEL_READELF                        "${DEFAULT_KERNEL_READELF}"
+	set_config_with_override STRING KERNEL_STRIP                          CMD_KERNEL_STRIP                          "${DEFAULT_KERNEL_STRIP}"
+	set_config_with_override STRING UTILS_AS                              CMD_UTILS_AS                              "${DEFAULT_UTILS_AS}"
+	set_config_with_override STRING UTILS_AR                              CMD_UTILS_AR                              "${DEFAULT_UTILS_AR}"
 	set_config_with_override STRING UTILS_CC                              CMD_UTILS_CC                              "${DEFAULT_UTILS_CC}"
+	set_config_with_override STRING UTILS_CFLAGS                          CMD_UTILS_CFLAGS                          "${DEFAULT_UTILS_CFLAGS}"
 	set_config_with_override STRING UTILS_CXX                             CMD_UTILS_CXX                             "${DEFAULT_UTILS_CXX}"
 	set_config_with_override STRING UTILS_LD                              CMD_UTILS_LD                              "${DEFAULT_UTILS_LD}"
-	set_config_with_override STRING UTILS_AS                              CMD_UTILS_AS                              "${DEFAULT_UTILS_AS}"
+	set_config_with_override STRING UTILS_NM                              CMD_UTILS_NM                              "${DEFAULT_UTILS_NM}"
+	set_config_with_override STRING UTILS_MAKE                            CMD_UTILS_MAKE                            "${DEFAULT_UTILS_MAKE}"
+	set_config_with_override STRING UTILS_OBJCOPY                         CMD_UTILS_OBJCOPY                         "${DEFAULT_UTILS_OBJCOPY}"
+	set_config_with_override STRING UTILS_OBJDUMP                         CMD_UTILS_OBJDUMP                         "${DEFAULT_UTILS_OBJDUMP}"
+	set_config_with_override STRING UTILS_RANLIB                          CMD_UTILS_RANLIB                          "${DEFAULT_UTILS_RANLIB}"
+	set_config_with_override STRING UTILS_READELF                         CMD_UTILS_READELF                         "${DEFAULT_UTILS_READELF}"
+	set_config_with_override STRING UTILS_STRIP                           CMD_UTILS_STRIP                           "${DEFAULT_UTILS_STRIP}"
 
 	set_config_with_override STRING CROSS_COMPILE                         CMD_CROSS_COMPILE
 	set_config_with_override STRING BOOTDIR                               CMD_BOOTDIR                               "/boot"


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: defaults/, /
@ 2020-08-28 20:18 Thomas Deutschmann
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Deutschmann @ 2020-08-28 20:18 UTC (permalink / raw
  To: gentoo-commits

commit:     88e1dd1c2ab49f232fed596927c15c3781fc6b28
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 28 15:22:56 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Aug 28 16:35:59 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=88e1dd1c

defaults/linuxrc: Add gksosreport

To help debugging, 'gksosreport' was added (idea was borrowed from dracut):

Whenever a user run into a problem and get to a rescue shell, running "gksosreport"
will generate /run/initramfs/gksosreport.txt containing useful debug information
suitable to attach to bug reports.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/gksosreport.sh | 74 +++++++++++++++++++++++++++++++++++++++++++++++++
 defaults/initrd.scripts | 20 +++++++++----
 defaults/linuxrc        |  4 +--
 gen_initramfs.sh        |  8 +++++-
 4 files changed, 98 insertions(+), 8 deletions(-)

diff --git a/defaults/gksosreport.sh b/defaults/gksosreport.sh
new file mode 100644
index 0000000..03b44b6
--- /dev/null
+++ b/defaults/gksosreport.sh
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+echo 'Generating "/run/initramfs/gksosreport.txt" ...'
+
+if [ ! -d /run/initramfs ]
+then
+	mkdir -p /run/initramfs
+	chmod 0750 /run/initramfs
+fi
+
+exec >/run/initramfs/gksosreport.txt 2>&1
+
+PWFILTER='s/\(ftp:\/\/.*\):.*@/\1:*******@/g;s/\(cifs:\/\/.*\):.*@/\1:*******@/g;s/cifspass=[^ ]*/cifspass=*******/g;s/iscsi:.*@/iscsi:******@/g;s/rd.iscsi.password=[^ ]*/rd.iscsi.password=******/g;s/rd.iscsi.in.password=[^ ]*/rd.iscsi.in.password=******/g'
+
+echo "Genkernel SOS report from $(date +'%Y-%m-%d %H:%M:%S'):"
+
+set -x
+
+cat /lib/dracut/dracut-gk-version.info
+
+cat /lib/dracut/build-parameter.txt
+
+cat /proc/cmdline | sed -e "${PWFILTER}"
+
+[ -f /etc/cmdline ] && cat /etc/cmdline | sed -e "${PWFILTER}"
+
+lspci -k
+
+lsmod
+
+find /lib/modules/$(uname -r) -type f
+
+cat /proc/self/mountinfo
+cat /proc/mounts
+
+blkid
+blkid -o udev
+
+ls -l /dev/disk/by*
+
+if hash lvm >/dev/null 2>/dev/null
+then
+	lvm pvdisplay
+	lvm vgdisplay
+	lvm lvdisplay
+fi
+
+if hash dmsetup >/dev/null 2>/dev/null
+then
+	dmsetup ls --tree
+fi
+
+if [ -e /proc/mdstat ]
+then
+	cat /proc/mdstat
+fi
+
+if hash cryptsetup >/dev/null 2>/dev/null
+then
+	if [ -e /dev/mapper/root ]
+	then
+		cryptsetup status /dev/mapper/root
+	fi
+fi
+
+if hash ip >/dev/null 2>/dev/null
+then
+	ip link
+	ip addr
+fi
+
+dmesg | sed -e "${PWFILTER}"
+
+[ -f /run/initramfs/init.log ] && cat /run/initramfs/init.log | sed -e "${PWFILTER}"

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 36f4791..7a84755 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -983,7 +983,7 @@ check_loop() {
 		bad_msg 'Please export LOOP with a valid location, or reboot and pass a proper loop=...'
 		bad_msg 'kernel command line!'
 
-		run_shell
+		run_emergency_shell
 	fi
 }
 
@@ -1001,6 +1001,14 @@ run() {
 	return ${retval}
 }
 
+run_emergency_shell() {
+	echo
+	gksosreport
+	good_msg 'You might want to save "/run/initramfs/gksosreport.txt" to a USB stick or /boot'
+	good_msg 'after mounting them and attach it to a bug report.'
+	run_shell
+}
+
 run_shell() {
 	if [ -f "${GK_USERINTERACTION_DISABLED_STATEFILE}" ]
 	then
@@ -1092,7 +1100,7 @@ test_success() {
 		error_string=${1}
 		error_string="${error_string:-Failed to run command}"
 		bad_msg "${error_string}; Failing back to the shell ..."
-		run_shell
+		run_emergency_shell
 	fi
 }
 
@@ -1347,7 +1355,7 @@ prompt_user() {
 		'shell')
 			eval ${1}'='${oldvalue}
 			warn_msg "To leave and try again just press <Ctrl>+D"
-			run_shell
+			run_emergency_shell
 			;;
 		'')
 			eval ${1}'='${oldvalue}
@@ -1799,7 +1807,7 @@ openLUKS() {
 		# if crypt_silent=1 and some error occurs, enter shell quietly
 		elif [ \( ${CRYPT_SILENT} -eq 1 \) -a \( \( \( ${DEV_ERROR} -eq 1 \) -o \( ${KEY_ERROR} -eq 1 \) \) -o \( ${KEYDEV_ERROR} -eq 1 \) \) ]
 		then
-			run_shell
+			run_emergency_shell
 		elif [ ${DEV_ERROR} -eq 1 ]
 		then
 			prompt_user "LUKS_DEVICE" "${LUKS_NAME}"
@@ -2487,7 +2495,7 @@ cdupdate() {
 			if [ "$?" != '0' ]
 			then
 				bad_msg "Executing cdupdate.sh failed!"
-				run_shell
+				run_emergency_shell
 			fi
 		else
 			good_msg 'No cdupdate.sh script found, skipping ...'
@@ -2511,6 +2519,8 @@ rundebugshell() {
 	if is_debug
 	then
 		good_msg 'Starting debug shell as requested by "debug" option.'
+		good_msg "Run '${BOLD}gksosreport${NORMAL}' to generate debug report"
+		good_msg "in case you want to file a bug report."
 	else
 		return 0
 	fi

diff --git a/defaults/linuxrc b/defaults/linuxrc
index 061d3e0..e96b637 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -1071,7 +1071,7 @@ then
 						grep -Fq squashfs /proc/filesystems || \
 							bad_msg "HINT: Your kernel does not know filesystem \"squashfs\"."
 					fi
-					run_shell
+					run_emergency_shell
 				}
 			fi
 
@@ -1188,7 +1188,7 @@ FSTAB
 		) ||
 		{
 			bad_msg "Copying failed, dropping into a shell."
-			run_shell
+			run_emergency_shell
 		}
 
 		# Now we do the links.

diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 27e98fc..315bb22 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -348,6 +348,12 @@ append_base_layout() {
 	echo "Genkernel $GK_V" > "${TDIR}"/etc/build_id \
 		|| gen_die "Failed to create '${TDIR}/etc/build_id'!"
 
+	cp -a "${GK_SHARE}"/defaults/gksosreport.sh "${TDIR}"/usr/sbin/gksosreport \
+		|| gen_die "Failed to copy '${GK_SHARE}/defaults/gksosreport.sh' to '${TDIR}/usr/sbin/gksosreport'"
+
+	chmod 0755 "${TDIR}"/usr/sbin/gksosreport \
+		|| gen_die "Failed to chmod of '${TDIR}/usr/sbin/gksosreport'!"
+
 	# Allow lsinitrd from dracut to process our initramfs
 	echo "$(cat "${TDIR}/etc/build_id") ($(cat "${TDIR}/etc/build_date"))" > "${TDIR}"/lib/dracut/dracut-gk-version.info \
 		|| gen_die "Failed to create '${TDIR}/lib/dracut/dracut-gk-version.info'!"
@@ -474,7 +480,7 @@ append_busybox() {
 	done
 
 	# Set up a few default symlinks
-	local required_applets='[ ash sh mkdir mknod mount uname echo cut cat touch'
+	local required_applets='[ ash sh mkdir mknod mount uname echo chmod cut cat touch'
 	local required_applet=
 	for required_applet in ${required_applets}
 	do


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

end of thread, other threads:[~2020-08-28 20:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-12 21:04 [gentoo-commits] proj/genkernel:master commit in: defaults/, / Mike Frysinger
  -- strict thread matches above, loose matches on Subject: below --
2016-01-05 18:51 Richard Farina
2017-01-02 20:14 Matt Thode
2019-11-24 20:00 Thomas Deutschmann
2020-01-12 14:59 Thomas Deutschmann
2020-07-16 15:03 Thomas Deutschmann
2020-07-23 23:57 Thomas Deutschmann
2020-08-01 21:41 Thomas Deutschmann
2020-08-28 20:18 Thomas Deutschmann
2020-08-28 20:18 Thomas Deutschmann

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