summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-08-05 00:25:12 +0200
committerThomas Deutschmann <whissi@gentoo.org>2020-08-05 01:02:40 +0200
commit4860fce5434f46d90e913ff10515a9a256fc6c6a (patch)
tree9752dd729b752b1bb528ab43177edba192a7b65c /sys-apps/kexec-tools/files/kexec-r2.init
parentsys-apps/kexec-tools: runscript: add support for genkernel's default kernel/i... (diff)
downloadgentoo-4860fce5434f46d90e913ff10515a9a256fc6c6a.tar.gz
gentoo-4860fce5434f46d90e913ff10515a9a256fc6c6a.tar.bz2
gentoo-4860fce5434f46d90e913ff10515a9a256fc6c6a.zip
sys-apps/kexec-tools: runscript: do not append root= if --reuse-cmdline is used
Always appending root= can cause problems when auto-detection is used when real system and initramfs don't agree on naming (i.e. when current system detects root as /dev/dm-4 but on next boot, initramfs will detect root as /dev/dm-5). Package-Manager: Portage-3.0.1, Repoman-2.3.23 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'sys-apps/kexec-tools/files/kexec-r2.init')
-rw-r--r--sys-apps/kexec-tools/files/kexec-r2.init12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys-apps/kexec-tools/files/kexec-r2.init b/sys-apps/kexec-tools/files/kexec-r2.init
index 2a3b63ad526..0578f51aea1 100644
--- a/sys-apps/kexec-tools/files/kexec-r2.init
+++ b/sys-apps/kexec-tools/files/kexec-r2.init
@@ -119,12 +119,22 @@ load_image() {
fi
fi
+ local is_rootpart_autodetected=no
if [ -z "${ROOTPART}" ]; then
ROOTPART="$(readlink -f "$(sed -n '/^\/[^ ]* \/ / s,^\([^ ]*\).*,\1,p' /proc/mounts)")"
+ is_rootpart_autodetected=yes
fi
+ local is_reusing_cmdline=no
if [ -z "${KPARAM}" ]; then
kparamopt="--reuse-cmdline"
+ is_reusing_cmdline=yes
+ fi
+
+ if ! yesno "${is_rootpart_autodetected}" || ! yesno "${is_reusing_cmdline}"; then
+ # Only append root when explicit set in config or
+ # if we aren't re-using kernel cmdline
+ KPARAM="${KPARAM:+"${KPARAM} "}root=${ROOTPART}"
fi
if [ -n "${initrd}" ]; then
@@ -137,7 +147,7 @@ load_image() {
ebegin "Using kernel image ${img}${msg} for kexec"
kexec ${KEXEC_OPT_ARGS} ${kparamopt} \
- -l "${img}" --append="root=${ROOTPART} ${KPARAM}" ${initrdopt}
+ -l "${img}" ${KPARAM:+--append="${KPARAM}"} ${initrdopt}
local ret=$?
${mounted} && umount "${BOOTPART}"