diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-08-25 10:45:55 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-08-25 10:45:55 +0100 |
commit | 3cf7c3ef441822c889356fd1812ebf2944a59851 (patch) | |
tree | c513fe68548b40365c1c2ebfe35c58ad431cdd77 /sys-apps/kexec-tools/files | |
parent | 05b8b0e0af1d72e51a3ee61522941bf7605cd01c (diff) |
gentoo resync : 25.08.2020
Diffstat (limited to 'sys-apps/kexec-tools/files')
-rw-r--r-- | sys-apps/kexec-tools/files/kexec-r2.init (renamed from sys-apps/kexec-tools/files/kexec.init-2.0.13-r1) | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/sys-apps/kexec-tools/files/kexec.init-2.0.13-r1 b/sys-apps/kexec-tools/files/kexec-r2.init index 167b792de85d..0578f51aea19 100644 --- a/sys-apps/kexec-tools/files/kexec.init-2.0.13-r1 +++ b/sys-apps/kexec-tools/files/kexec-r2.init @@ -1,5 +1,5 @@ #!/sbin/openrc-run -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # Set up some defaults. @@ -14,16 +14,16 @@ depend() { auto_prefix_bootpath() { # Only auto-add prefix to relative paths. case $1 in - */*) echo "$1";; - *) echo "${BOOTPART}/$1" ;; + */*) echo "$1";; + *) echo "${BOOTPART}/$1" ;; esac } get_genkernel_arch() { case $1 in - x86_64) echo "amd64" ;; - i[3456]86) echo "x86" ;; - *) echo "$1" ;; + x86_64) echo "amd64" ;; + i[3456]86) echo "x86" ;; + *) echo "$1" ;; esac } @@ -34,12 +34,13 @@ image_path() { return fi - local x kver="$(uname -r)" karch="$(uname -m)" + local x kver="$(uname -r)" karch="$(uname -m)" local gkarch="$(get_genkernel_arch $karch)" for x in \ "bzImage" \ "vmlinux" \ "vmlinuz" \ + "kernel" \ "bzImage-${kver}" \ "vmlinux-${kver}" \ "vmlinuz-${kver}" \ @@ -67,6 +68,7 @@ initrd_path() { local gkarch="$(get_genkernel_arch $karch)" for x in \ "initrd" \ + "initramfs" \ "initrd.img-${kver}" \ "initrd-${kver}.img" \ "initrd-${kver}" \ @@ -117,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 @@ -135,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}" |