Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 574054 | Differences between
and this patch

Collapse All | Expand All

(-)a/sys-apps/kexec-tools/files/kexec.conf-2.0.9-r3 (-2 / +34 lines)
Line 0 Link Here
0
- 
1
# Load kexec kernel image into memory during shutdown instead of bootup
2
# (default: yes)
3
#LOAD_DURING_SHUTDOWN="yes"
4
5
# Additional arguments passed to kexec (8)
6
#KEXEC_OPT_ARGS=""
7
8
# Kernel image partition. Mounted automatically if not.
9
# (default: /boot)
10
#BOOTPART="/boot"
11
12
# Root partition (should be autodetected)
13
#ROOTPART="/dev/hda3"
14
15
# Kernel image pathname, relative from BOOTPART.
16
# If it's one of 
17
# {kernel-genkernel,bzImage,vmlinuz,kernel}-<currently running kernel version>,
18
# or bzImage, vmlinuz (without suffix),
19
# then it's automaticaly detected.
20
# Setting it to "-" will disable kexec.
21
#KNAME="vmlinuz-3.9.0"
22
23
# Initrd
24
# Same automatic detection restriction as for KNAME apply.
25
# initramfs-genkernel-<currently running kernel version>,
26
# initrd{,.img}-<currently running kernel version>{,.img}
27
# will be detected.
28
#INITRD="/boot/fbsplash-emergence-1024x768"
29
30
# Kernel parameters (should be autodetected)
31
#KPARAM="splash=silent,theme:emergence"
32
33
# Do not try to mount /boot
34
# DONT_MOUNT_BOOT="yes"
1
option
35
option
2
--
3
sys-apps/kexec-tools/files/kexec.conf-2.0.9-r3 | 4 ++++
36
sys-apps/kexec-tools/files/kexec.conf-2.0.9-r3 | 4 ++++
4
1 file changed, 4 insertions(+)
37
1 file changed, 4 insertions(+)
(-)a/sys-apps/kexec-tools/files/kexec.conf-2.0.9-r3 (-2 / +4 lines)
Lines 2-7 Link Here
2
# (default: yes)
2
# (default: yes)
3
#LOAD_DURING_SHUTDOWN="yes"
3
#LOAD_DURING_SHUTDOWN="yes"
4
4
5
# Load kexec kernel image via kexec_load_file() instead of kexec_load()
6
# (default: no)
7
#KEXEC_LOAD_FILE="no"
8
5
# Additional arguments passed to kexec (8)
9
# Additional arguments passed to kexec (8)
6
#KEXEC_OPT_ARGS=""
10
#KEXEC_OPT_ARGS=""
7
11
8
- 
9
--
10
sys-apps/kexec-tools/files/kexec.init-2.0.9-r3 | 165 +++++++++++++++++++++++++
12
sys-apps/kexec-tools/files/kexec.init-2.0.9-r3 | 165 +++++++++++++++++++++++++
11
1 file changed, 165 insertions(+)
13
1 file changed, 165 insertions(+)
12
create mode 100644 sys-apps/kexec-tools/files/kexec.init-2.0.9-r3
14
create mode 100644 sys-apps/kexec-tools/files/kexec.init-2.0.9-r3
(-)a/sys-apps/kexec-tools/files/kexec.init-2.0.9-r3 (-2 / +165 lines)
Line 0 Link Here
0
- 
1
#!/sbin/runscript
2
# Copyright 1999-2015 Gentoo Foundation
3
# Distributed under the terms of the GNU General Public License v2
4
# $Id$
5
6
depend() {
7
	need localmount
8
}
9
10
image_path() {
11
	local x= kver=$(uname -r) karch=$(uname -m)
12
	BOOTPART="${BOOTPART:-/boot}"
13
	KNAME="${KNAME:-bzImage}"
14
	if [ -e "${KNAME}" ]; then
15
		echo "${KNAME}"
16
		return 0
17
	fi
18
	for x in "${KNAME#${BOOTPART}}" vmlinuz \
19
		bzImage-${kver} vmlinuz-${kver} \
20
		kernel-genkernel-${karch}-${kver} \
21
		kernel-${kver} kernel-${karch}; do
22
		if [ -e "${BOOTPART}/${x}" ]; then
23
			echo "${BOOTPART}/${x}"
24
			return 0
25
		fi
26
	done
27
28
	return 1
29
}
30
31
initrd_path() {
32
	local x= kver=$(uname -r) karch=$(uname -m)
33
	BOOTPART="${BOOTPART:-/boot}"
34
	INITRD="${INITRD:-initrd}"
35
	if [ -e "${INITRD}" ]; then
36
		echo "${INITRD}"
37
		return 0
38
	fi
39
	for x in "${INITRD#${BOOTPART}}" \
40
		initrd.img-${kver} initrd-${kver}.img \
41
		initrd-${kver} initramfs-${kver}.img \
42
		initramfs-genkernel-${karch}-${kver} ; do
43
		if [ -e "${BOOTPART}/${x}" ]; then
44
			echo "${BOOTPART}/${x}"
45
			return 0
46
		fi
47
	done
48
49
	return 1
50
}
51
52
mount_boot(){
53
	local ret
54
55
	[ "${DONT_MOUNT_BOOT:-no}" = "no" ] || return 1
56
	grep -q " ${BOOTPART:-/boot} " /proc/mounts && return 1
57
58
	BOOTPART="${BOOTPART:-/boot}"
59
	ebegin "Mounting ${BOOTPART}"
60
	mount "${BOOTPART}"; ret=$?
61
	eend ${ret}
62
	return ${ret}
63
}
64
65
load_image() {
66
	local ret
67
	if [ "${KNAME}" = "-" ]; then
68
		ebegin "Disabling kexec"
69
		kexec -u; ret=$?
70
		eend ${ret}
71
		return ${ret}
72
	fi
73
74
	BOOTPART="${BOOTPART:-/boot}"
75
	local img= initrd="$(initrd_path)" mounted=false initrdopt=
76
77
	if ! img="$(image_path)"; then
78
		if mount_boot; then
79
			if img="$(image_path)"; then
80
				mounted=true
81
				initrd="$(initrd_path)"
82
			else
83
				eerror "No kernel image found in ${BOOTPART}!"
84
				umount "${BOOTPART}"
85
				return 1
86
			fi
87
		else
88
			eerror "No kernel image found in ${BOOTPART}!"
89
			return 1
90
		fi
91
	fi
92
93
	if [ -n "${INITRD}" ] && \
94
		! [ "${BOOTPART}/${INITRD#${BOOTPART}}" = "${initrd}" ]; then
95
		eerror "Requested initrd: ${INITRD#${BOOTPART}}"
96
		eerror "could not be found"
97
		return 1
98
	fi
99
100
	[ -n "${ROOTPART}" ] || \
101
		ROOTPART="$(readlink -f "$(sed -n '/^\/[^ ]* \/ / s,^\([^ ]*\).*,\1,p' /proc/mounts)")"
102
103
	[ -n "${KPARAM}" ] || KEXEC_OPT_ARGS="${KEXEC_OPT_ARGS} --reuse-cmdline"
104
105
	[ -n "${initrd}" ] && [ -e "${initrd}" ] && initrdopt="--initrd=${initrd}"
106
107
	local msg=
108
	[ -n "${initrd}" ] && \
109
		msg="with ${initrd}"
110
	einfo "Using kernel image ${img} ${msg} for kexec"
111
112
	ebegin "Setting kexec with ${KEXEC_OPT_ARGS} -l ${img} root=${ROOTPART} ${KPARAM} ${initrdopt}"
113
	kexec ${KEXEC_OPT_ARGS} -l "${img}" --append="root=${ROOTPART} ${KPARAM}" ${initrdopt}
114
	local res=$?
115
116
	${mounted} && umount "${BOOTPART}"
117
	eend ${res}
118
	return ${res}
119
}
120
121
start() {
122
	if [ "${LOAD_DURING_SHUTDOWN:-yes}" = "yes" ]; then
123
		local ret=0
124
		BOOTPART="${BOOTPART:-/boot}"
125
		if mount_boot; then
126
			mounted=true
127
		fi
128
		if ! image_path > /dev/null; then
129
			ewarn "Cannot find kernel image!"
130
			ewarn "Please make sure a valid kernel image is present before reboot."
131
			return 0
132
		fi
133
		if [ -n "${mounted}" ]; then
134
			ebegin "Unmounting ${BOOTPART}"
135
			umount "${BOOTPART}"; ret=$?
136
			eend ${ret}
137
		fi
138
		return ${ret}
139
	else
140
		ebegin "Configuring kexec"
141
		load_image
142
		eend $?
143
	fi
144
}
145
146
stop() {
147
	if ! yesno $RC_REBOOT; then
148
		einfo "Not rebooting, so disabling"
149
		kexec -u
150
		return 0
151
	fi
152
153
	if [ -f /nokexec ]; then
154
		einfo "Not using kexec during reboot"
155
		rm -f /nokexec
156
		kexec -u
157
		return 0
158
	fi
159
160
	[ "${LOAD_DURING_SHUTDOWN:-yes}" != "yes" ] && return 0
161
162
	ebegin "Configuring kexec"
163
	load_image
164
	eend $?
165
}
1
load_image()
166
load_image()
2
 # kexec -d start
167
 # kexec -d start
3
 [snip]
168
 [snip]
4
 + '[' -n /boot/initramfs.cpio.gz ']'
169
 + '[' -n /boot/initramfs.cpio.gz ']'
5
 + '[' /boot//initramfs.cpio.gz = /boot/initramfs.cpio.gz ']'
170
 + '[' /boot//initramfs.cpio.gz = /boot/initramfs.cpio.gz ']'
6
 + eerror 'Requested initrd: /initramfs.cpio.gz'
171
 + eerror 'Requested initrd: /initramfs.cpio.gz'
7
  * Requested initrd: /initramfs.cpio.gz
172
  * Requested initrd: /initramfs.cpio.gz
8
 + eerror 'could not be found'
173
 + eerror 'could not be found'
9
  * could not be found
174
  * could not be found
10
 + return 1
175
 + return 1
11
--
12
sys-apps/kexec-tools/files/kexec.init-2.0.4-r3 | 2 +-
176
sys-apps/kexec-tools/files/kexec.init-2.0.4-r3 | 2 +-
13
1 file changed, 1 insertion(+), 1 deletion(-)
177
1 file changed, 1 insertion(+), 1 deletion(-)
(-)a/sys-apps/kexec-tools/files/kexec.init-2.0.4-r3 (-3 / +1 lines)
Lines 91-97 load_image() { Link Here
91
	fi
91
	fi
92
92
93
	if [ -n "${INITRD}" ] && \
93
	if [ -n "${INITRD}" ] && \
94
		! [ "${BOOTPART}/${INITRD#${BOOTPART}}" = "${initrd}" ]; then
94
		! [ "${BOOTPART}/${INITRD#${BOOTPART}/}" = "${initrd}" ]; then
95
		eerror "Requested initrd: ${INITRD#${BOOTPART}}"
95
		eerror "Requested initrd: ${INITRD#${BOOTPART}}"
96
		eerror "could not be found"
96
		eerror "could not be found"
97
		return 1
97
		return 1
98
- 
99
kexec-tools-2.0.4-r3.ebuild
98
kexec-tools-2.0.4-r3.ebuild
100
--
101
sys-apps/kexec-tools/kexec-tools-2.0.4-r3.ebuild | 73 ++++++++++++++++++++++++
99
sys-apps/kexec-tools/kexec-tools-2.0.4-r3.ebuild | 73 ++++++++++++++++++++++++
102
1 file changed, 73 insertions(+)
100
1 file changed, 73 insertions(+)
103
create mode 100644 sys-apps/kexec-tools/kexec-tools-2.0.4-r3.ebuild
101
create mode 100644 sys-apps/kexec-tools/kexec-tools-2.0.4-r3.ebuild
(-)a/sys-apps/kexec-tools/kexec-tools-2.0.4-r3.ebuild (-2 / +73 lines)
Line 0 Link Here
0
- 
1
# Copyright 1999-2013 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
3
# $Id$
4
5
EAPI=5
6
7
inherit autotools-utils flag-o-matic linux-info systemd
8
9
DESCRIPTION="Load another kernel from the currently executing Linux kernel"
10
HOMEPAGE="https://kernel.org/pub/linux/utils/kernel/kexec/"
11
SRC_URI="mirror://kernel/linux/utils/kernel/kexec/${P}.tar.xz"
12
13
LICENSE="GPL-2"
14
SLOT="0"
15
KEYWORDS="amd64 x86"
16
IUSE="booke lzma xen zlib"
17
18
REQUIRED_USE="lzma? ( zlib )"
19
20
DEPEND="
21
	lzma? ( app-arch/xz-utils )
22
	zlib? ( sys-libs/zlib )"
23
RDEPEND="${DEPEND}"
24
25
CONFIG_CHECK="~KEXEC"
26
27
PATCHES=(
28
		"${FILESDIR}"/${PN}-2.0.0-respect-LDFLAGS.patch
29
		"${FILESDIR}"/${P}-disable-kexec-test.patch
30
		"${FILESDIR}"/${P}-out-of-source.patch
31
	)
32
33
pkg_setup() {
34
	# GNU Make's $(COMPILE.S) passes ASFLAGS to $(CCAS), CCAS=$(CC)
35
	export ASFLAGS="${CCASFLAGS}"
36
	# to disable the -fPIE -pie in the hardened compiler
37
	if gcc-specs-pie ; then
38
		filter-flags -fPIE
39
		append-ldflags -nopie
40
	fi
41
}
42
43
src_configure() {
44
	local myeconfargs=(
45
		$(use_with booke)
46
		$(use_with lzma)
47
		$(use_with xen)
48
		$(use_with zlib)
49
		)
50
	autotools-utils_src_configure
51
}
52
53
src_install() {
54
	autotools-utils_src_install
55
56
	dodoc "${FILESDIR}"/README.Gentoo
57
58
	newinitd "${FILESDIR}"/kexec.init-${PVR} kexec
59
	newconfd "${FILESDIR}"/kexec.conf-${PV} kexec
60
61
	insinto /etc
62
	doins "${FILESDIR}"/kexec.conf
63
64
	systemd_dounit "${FILESDIR}"/kexec.service
65
}
66
67
pkg_postinst() {
68
	if systemd_is_booted || has_version sys-apps/systemd; then
69
		elog "For systemd support the new config file is"
70
		elog "   /etc/kexec.conf"
71
		elog "Please adopt it to your needs as there is no autoconfig anymore"
72
	fi
73
}
1
kexec-tools-2.0.9-r3.ebuild
74
kexec-tools-2.0.9-r3.ebuild
2
--
3
sys-apps/kexec-tools/kexec-tools-2.0.9-r3.ebuild | 71 ++++++++++++++++++++++++
75
sys-apps/kexec-tools/kexec-tools-2.0.9-r3.ebuild | 71 ++++++++++++++++++++++++
4
1 file changed, 71 insertions(+)
76
1 file changed, 71 insertions(+)
5
create mode 100644 sys-apps/kexec-tools/kexec-tools-2.0.9-r3.ebuild
77
create mode 100644 sys-apps/kexec-tools/kexec-tools-2.0.9-r3.ebuild
(-)a/sys-apps/kexec-tools/kexec-tools-2.0.9-r3.ebuild (-2 / +71 lines)
Line 0 Link Here
0
- 
1
# Copyright 1999-2015 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
3
# $Id$
4
5
EAPI=5
6
7
inherit autotools-utils linux-info systemd
8
9
DESCRIPTION="Load another kernel from the currently executing Linux kernel"
10
HOMEPAGE="https://kernel.org/pub/linux/utils/kernel/kexec/"
11
SRC_URI="mirror://kernel/linux/utils/kernel/kexec/${P}.tar.xz"
12
13
LICENSE="GPL-2"
14
SLOT="0"
15
KEYWORDS="~amd64 ~x86"
16
IUSE="booke lzma xen zlib"
17
18
REQUIRED_USE="lzma? ( zlib )"
19
20
DEPEND="
21
	lzma? ( app-arch/xz-utils )
22
	zlib? ( sys-libs/zlib )"
23
RDEPEND="${DEPEND}"
24
25
CONFIG_CHECK="~KEXEC"
26
27
PATCHES=(
28
	"${FILESDIR}"/${PN}-2.0.4-disable-kexec-test.patch
29
	"${FILESDIR}"/${PN}-2.0.4-out-of-source.patch
30
	"${FILESDIR}"/${PN}-2.0.9-hardened.patch
31
)
32
33
pkg_setup() {
34
	# GNU Make's $(COMPILE.S) passes ASFLAGS to $(CCAS), CCAS=$(CC)
35
	export ASFLAGS="${CCASFLAGS}"
36
}
37
38
src_configure() {
39
	local myeconfargs=(
40
		$(use_with booke)
41
		$(use_with lzma)
42
		$(use_with xen)
43
		$(use_with zlib)
44
	)
45
	autotools-utils_src_configure
46
}
47
48
src_install() {
49
	autotools-utils_src_install
50
51
	dodoc "${FILESDIR}"/README.Gentoo
52
53
	newinitd "${FILESDIR}"/kexec.init-2.0.4-r3 kexec
54
	newconfd "${FILESDIR}"/kexec.conf-2.0.4 kexec
55
56
	insinto /etc
57
	doins "${FILESDIR}"/kexec.conf
58
59
	insinto /etc/kernel/postinst.d
60
	doins "${FILESDIR}"/90_kexec
61
62
	systemd_dounit "${FILESDIR}"/kexec.service
63
}
64
65
pkg_postinst() {
66
	if systemd_is_booted || has_version sys-apps/systemd; then
67
		elog "For systemd support the new config file is"
68
		elog "   /etc/kexec.conf"
69
		elog "Please adopt it to your needs as there is no autoconfig anymore"
70
	fi
71
}
1
support KEXEC_FILE_LOAD
72
support KEXEC_FILE_LOAD
2
--
3
sys-apps/kexec-tools/kexec-tools-2.0.9-r3.ebuild | 6 +++---
73
sys-apps/kexec-tools/kexec-tools-2.0.9-r3.ebuild | 6 +++---
4
1 file changed, 3 insertions(+), 3 deletions(-)
74
1 file changed, 3 insertions(+), 3 deletions(-)
(-)a/sys-apps/kexec-tools/kexec-tools-2.0.9-r3.ebuild (-4 / +3 lines)
Lines 1-4 Link Here
1
# Copyright 1999-2015 Gentoo Foundation
1
# Copyright 1999-2016 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
# $Id$
3
# $Id$
4
4
Lines 50-57 src_install() { Link Here
50
50
51
	dodoc "${FILESDIR}"/README.Gentoo
51
	dodoc "${FILESDIR}"/README.Gentoo
52
52
53
	newinitd "${FILESDIR}"/kexec.init-2.0.4-r3 kexec
53
	newinitd "${FILESDIR}"/kexec.init-2.0.9-r3 kexec
54
	newconfd "${FILESDIR}"/kexec.conf-2.0.4 kexec
54
	newconfd "${FILESDIR}"/kexec.conf-2.0.9-r3 kexec
55
55
56
	insinto /etc
56
	insinto /etc
57
	doins "${FILESDIR}"/kexec.conf
57
	doins "${FILESDIR}"/kexec.conf
58
- 

Return to bug 574054