diff options
author | Mike Frysinger <vapier@gentoo.org> | 2016-03-24 17:24:44 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2016-03-24 17:39:33 -0400 |
commit | 292b70740c3eb4516bf99a2cc2d12657a031ab00 (patch) | |
tree | cfef28fe459bdadab2d8973137874968da2c12c2 /sys-apps/kexec-tools | |
parent | sys-apps/kexec-tools: drop some old versions (diff) | |
download | gentoo-292b70740c3eb4516bf99a2cc2d12657a031ab00.tar.gz gentoo-292b70740c3eb4516bf99a2cc2d12657a031ab00.tar.bz2 gentoo-292b70740c3eb4516bf99a2cc2d12657a031ab00.zip |
sys-apps/kexec-tools: version bump to 2.0.12 #578164
Rework the init script heavily in the process to make it a bit less
"smart" and respect user settings. #577496
Diffstat (limited to 'sys-apps/kexec-tools')
-rw-r--r-- | sys-apps/kexec-tools/Manifest | 1 | ||||
-rwxr-xr-x | sys-apps/kexec-tools/files/kexec.init-2.0.12 | 175 | ||||
-rw-r--r-- | sys-apps/kexec-tools/kexec-tools-2.0.12.ebuild | 77 | ||||
-rw-r--r-- | sys-apps/kexec-tools/kexec-tools-9999.ebuild | 2 |
4 files changed, 254 insertions, 1 deletions
diff --git a/sys-apps/kexec-tools/Manifest b/sys-apps/kexec-tools/Manifest index 6a702451e5de..99653fee2e40 100644 --- a/sys-apps/kexec-tools/Manifest +++ b/sys-apps/kexec-tools/Manifest @@ -1,2 +1,3 @@ +DIST kexec-tools-2.0.12.tar.xz 274776 SHA256 14ce67b6242426a7ded10f58b7d29d3cfef5c1379850e8ba3816bb42053f920d SHA512 d192f841180daf534f7214b6c7c5dcd9de0e5616e8cb0da164c24e8b5903a2f65bb1fbe6ca29a3b9077fa6f6435cc33fda19a96584e1f393ee7a2fe56f374dab WHIRLPOOL 9895716544987682f4ba9cc0622afa14c7dc844482fedce29ec9780b8ff74f87cf2bd79ef58febe651fa3bc5934b6d54aaae31d2593fb32ea9fffdca1e5f8c91 DIST kexec-tools-2.0.4.tar.xz 271604 SHA256 e5f5ab00d746eb15b4714eca6a8ec5a1a86a62ce2bbdad1b3000161138a978c6 SHA512 2514f407d9150d2615dffc91a525fb28f159bef92b9543f9802e2618746b7d4c04137668ad8a8d8f0b75f68ed9057d09629ce736b6a061b5cf817b9d904f549e WHIRLPOOL 70ad298512e700cd1cdee7698e4fa68a769d91d3080d5d8387b8362ad49126ad68b0b6dbd1f13305958bdc988f805fa610e487682fd0eb5e4e9bcda0a9022627 DIST kexec-tools-2.0.9.tar.xz 272728 SHA256 8ae34a9ceb76350954e1e1e3ca9ab51da15862bd5f2fd14392208e60fb454f71 SHA512 b58f8f0872f1a6a3a93bc67068d7035c4b39e985dafadc573585d92259ff289bf98d5a567293a5286668315ac2158b232919e0c6847fdefc68b7ecbcfab5109e WHIRLPOOL 840d9d17ce9facc131736ef52acabb03bcc6d21f671896ff5603bd8d6bd629519e169ca878a127b863235b236dafd3b29f598424b272f599503bb3f1a5f70050 diff --git a/sys-apps/kexec-tools/files/kexec.init-2.0.12 b/sys-apps/kexec-tools/files/kexec.init-2.0.12 new file mode 100755 index 000000000000..7a202cc11014 --- /dev/null +++ b/sys-apps/kexec-tools/files/kexec.init-2.0.12 @@ -0,0 +1,175 @@ +#!/sbin/runscript +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# Set up some defaults. +: "${LOAD_DURING_SHUTDOWN:=yes}" +: "${BOOTPART:=/boot}" +: "${DONT_MOUNT_BOOT:=no}" + +depend() { + need localmount +} + +auto_prefix_bootpath() { + # Only auto-add prefix to relative paths. + case $1 in + */*) echo "$1";; + *) echo "${BOOTPART}/$1" ;; + esac +} + +image_path() { + # Do no sanity checking if the user has set a value. + if [ -n "${KNAME}" ]; then + auto_prefix_bootpath "${KNAME}" + return + fi + + local x kver="$(uname -r)" karch="$(uname -m)" + for x in \ + "bzImage" \ + "vmlinuz" \ + "bzImage-${kver}" \ + "vmlinuz-${kver}" \ + "kernel-genkernel-${karch}-${kver}" \ + "kernel-${kver}" \ + "kernel-${karch}"; do + if [ -e "${BOOTPART}/${x}" ]; then + echo "${BOOTPART}/${x}" + return + fi + done + + return 1 +} + +initrd_path() { + # Do no sanity checking if the user has set a value. + if [ -n "${INITRD}" ]; then + auto_prefix_bootpath "${INITRD}" + return 0 + fi + + local x kver="$(uname -r)" karch="$(uname -m)" + for x in \ + "initrd" \ + "initrd.img-${kver}" \ + "initrd-${kver}.img" \ + "initrd-${kver}" \ + "initramfs-${kver}.img" \ + "initramfs-genkernel-${karch}-${kver}"; do + if [ -e "${BOOTPART}/${x}" ]; then + echo "${BOOTPART}/${x}" + return 0 + fi + done + + return 1 +} + +mount_boot() { + [ "${DONT_MOUNT_BOOT}" != "no" ] && return 1 + mountinfo -q "${BOOTPART}" && return 1 + + ebegin "Mounting ${BOOTPART}" + mount "${BOOTPART}" + eend $? +} + +load_image() { + if [ "${KNAME}" = "-" ]; then + ebegin "Disabling kexec" + kexec -u + eend $? + return # eend preserved $? for us. + fi + + local img initrd="$(initrd_path)" mounted=false kparamopt initrdopt + + if ! img="$(image_path)"; then + if mount_boot; then + if img="$(image_path)"; then + mounted=true + initrd="$(initrd_path)" + else + eerror "No kernel image found in ${BOOTPART}!" + umount "${BOOTPART}" + return 1 + fi + else + eerror "No kernel image found in ${BOOTPART}!" + return 1 + fi + fi + + if [ -z "${ROOTPART}" ]; then + ROOTPART="$(readlink -f "$(sed -n '/^\/[^ ]* \/ / s,^\([^ ]*\).*,\1,p' /proc/mounts)")" + fi + + if [ -z "${KPARAM}" ]; then + kparamopt="--reuse-cmdline" + fi + + if [ -n "${initrd}" ]; then + initrdopt="--initrd=${initrd}" + fi + + local msg + [ -n "${initrd}" ] && \ + msg=" (with ${initrd})" + ebegin "Using kernel image ${img}${msg} for kexec" + + kexec ${KEXEC_OPT_ARGS} ${kparamopt} \ + -l "${img}" --append="root=${ROOTPART} ${KPARAM}" ${initrdopt} + local ret=$? + + ${mounted} && umount "${BOOTPART}" + eend ${ret} + return ${ret} +} + +start() { + if [ "${LOAD_DURING_SHUTDOWN}" = "yes" ]; then + local mounted + if mount_boot; then + mounted=true + fi + if ! image_path >/dev/null; then + ewarn "Cannot find kernel image!" + ewarn "Please make sure a valid kernel image is present before reboot." + return 0 + fi + if [ -n "${mounted}" ]; then + ebegin "Unmounting ${BOOTPART}" + umount "${BOOTPART}" + eend $? + fi + # $? is already set to the previous calls. + return + else + load_image + fi +} + +stop() { + if ! yesno ${RC_REBOOT}; then + ebegin "Not rebooting; disabling kexec" + kexec -u + eend $? + return + fi + + if [ -f /nokexec ]; then + ebegin "Rebooting; disabling kexec due to /nokexec" + rm -f /nokexec + kexec -u + eend $? + return + fi + + if [ "${LOAD_DURING_SHUTDOWN}" = "yes" ]; then + load_image + fi +} diff --git a/sys-apps/kexec-tools/kexec-tools-2.0.12.ebuild b/sys-apps/kexec-tools/kexec-tools-2.0.12.ebuild new file mode 100644 index 000000000000..2a2d1600e837 --- /dev/null +++ b/sys-apps/kexec-tools/kexec-tools-2.0.12.ebuild @@ -0,0 +1,77 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +if [[ ${PV} == "9999" ]] ; then + inherit git-r3 + EGIT_REPO_URI="git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git" + AUTOTOOLS_AUTORECONF=true +else + SRC_URI="mirror://kernel/linux/utils/kernel/kexec/${P}.tar.xz" + KEYWORDS="~amd64 ~x86" +fi + +inherit autotools-utils linux-info systemd + +DESCRIPTION="Load another kernel from the currently executing Linux kernel" +HOMEPAGE="https://kernel.org/pub/linux/utils/kernel/kexec/" + +LICENSE="GPL-2" +SLOT="0" +IUSE="booke lzma xen zlib" + +REQUIRED_USE="lzma? ( zlib )" + +DEPEND=" + lzma? ( app-arch/xz-utils ) + zlib? ( sys-libs/zlib )" +RDEPEND="${DEPEND}" + +CONFIG_CHECK="~KEXEC" + +PATCHES=( + "${FILESDIR}"/${PN}-2.0.4-disable-kexec-test.patch + "${FILESDIR}"/${PN}-2.0.4-out-of-source.patch +) + +pkg_setup() { + # GNU Make's $(COMPILE.S) passes ASFLAGS to $(CCAS), CCAS=$(CC) + export ASFLAGS="${CCASFLAGS}" +} + +src_configure() { + local myeconfargs=( + $(use_with booke) + $(use_with lzma) + $(use_with xen) + $(use_with zlib) + ) + autotools-utils_src_configure +} + +src_install() { + autotools-utils_src_install + + dodoc "${FILESDIR}"/README.Gentoo + + newinitd "${FILESDIR}"/kexec.init-2.0.12 kexec + newconfd "${FILESDIR}"/kexec.conf-2.0.4 kexec + + insinto /etc + doins "${FILESDIR}"/kexec.conf + + insinto /etc/kernel/postinst.d + doins "${FILESDIR}"/90_kexec + + systemd_dounit "${FILESDIR}"/kexec.service +} + +pkg_postinst() { + if systemd_is_booted || has_version sys-apps/systemd; then + elog "For systemd support the new config file is" + elog " /etc/kexec.conf" + elog "Please adopt it to your needs as there is no autoconfig anymore" + fi +} diff --git a/sys-apps/kexec-tools/kexec-tools-9999.ebuild b/sys-apps/kexec-tools/kexec-tools-9999.ebuild index 8e66b4e631b9..2a2d1600e837 100644 --- a/sys-apps/kexec-tools/kexec-tools-9999.ebuild +++ b/sys-apps/kexec-tools/kexec-tools-9999.ebuild @@ -56,7 +56,7 @@ src_install() { dodoc "${FILESDIR}"/README.Gentoo - newinitd "${FILESDIR}"/kexec.init-2.0.4-r3 kexec + newinitd "${FILESDIR}"/kexec.init-2.0.12 kexec newconfd "${FILESDIR}"/kexec.conf-2.0.4 kexec insinto /etc |