--- kexec.init-2.0.4-r3 2016-03-24 18:47:56.590152016 -0700 +++ kexec.init-2.0.9-r3 2016-02-06 16:31:46.000000000 -0800 @@ -1,5 +1,5 @@ #!/sbin/runscript -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2016 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ @@ -64,9 +64,15 @@ load_image() { local ret + local kexec_load_file + + if [ "${KEXEC_LOAD_FILE:-no}" = "yes" ]; then + kexec_load_file="-s" + fi + if [ "${KNAME}" = "-" ]; then ebegin "Disabling kexec" - kexec -u; ret=$? + kexec -u ${kexec_load_file}; ret=$? eend ${ret} return ${ret} fi @@ -109,8 +115,8 @@ msg="with ${initrd}" einfo "Using kernel image ${img} ${msg} for kexec" - ebegin "Setting kexec with ${KEXEC_OPT_ARGS} -l ${img} root=${ROOTPART} ${KPARAM} ${initrdopt}" - kexec ${KEXEC_OPT_ARGS} -l "${img}" --append="root=${ROOTPART} ${KPARAM}" ${initrdopt} + ebegin "Setting kexec with ${kexec_load_file} ${KEXEC_OPT_ARGS} -l ${img} root=${ROOTPART} ${KPARAM} ${initrdopt}" + kexec ${kexec_load_file} ${KEXEC_OPT_ARGS} -l "${img}" --append="root=${ROOTPART} ${KPARAM}" ${initrdopt} local res=$? ${mounted} && umount "${BOOTPART}" @@ -144,16 +150,22 @@ } stop() { + local kexec_load_file + + if [ "${KEXEC_LOAD_FILE:-no}" = "yes" ]; then + kexec_load_file="-s" + fi + if ! yesno $RC_REBOOT; then einfo "Not rebooting, so disabling" - kexec -u + kexec -u ${kexec_load_file} return 0 fi if [ -f /nokexec ]; then einfo "Not using kexec during reboot" rm -f /nokexec - kexec -u + kexec -u ${kexec_load_file} return 0 fi