Lines 14-20
image_path() {
Link Here
|
14 |
bzImage-${kver} vmlinuz-${kver} \ |
14 |
bzImage-${kver} vmlinuz-${kver} \ |
15 |
kernel-genkernel-${karch}-${kver} \ |
15 |
kernel-genkernel-${karch}-${kver} \ |
16 |
kernel-${kver} kernel-${karch}; do |
16 |
kernel-${kver} kernel-${karch}; do |
17 |
if [[ -e "${BOOTPART}/${x}" ]] ; then |
17 |
if [ -e "${BOOTPART}/${x}" ] ; then |
18 |
echo "${BOOTPART}/${x}" |
18 |
echo "${BOOTPART}/${x}" |
19 |
return 0 |
19 |
return 0 |
20 |
fi |
20 |
fi |
Lines 30-36
initrd_path() {
Link Here
|
30 |
initrd.img-${kver} initrd-${kver}.img \ |
30 |
initrd.img-${kver} initrd-${kver}.img \ |
31 |
initrd-${kver} initramfs-${kver}.img \ |
31 |
initrd-${kver} initramfs-${kver}.img \ |
32 |
initramfs-genkernel-${karch}-${kver} ; do |
32 |
initramfs-genkernel-${karch}-${kver} ; do |
33 |
if [[ -e "${BOOTPART}/${x}" ]] ; then |
33 |
if [ -e "${BOOTPART}/${x}" ] ; then |
34 |
echo "${BOOTPART}/${x}" |
34 |
echo "${BOOTPART}/${x}" |
35 |
return 0 |
35 |
return 0 |
36 |
fi |
36 |
fi |
Lines 40-46
initrd_path() {
Link Here
|
40 |
} |
40 |
} |
41 |
|
41 |
|
42 |
load_image() { |
42 |
load_image() { |
43 |
if [[ "${KNAME}" = "-" ]]; then |
43 |
if [ "${KNAME}" = "-" ]; then |
44 |
ebegin "Disabling kexec" |
44 |
ebegin "Disabling kexec" |
45 |
kexec -u |
45 |
kexec -u |
46 |
eend $? |
46 |
eend $? |
Lines 50-56
load_image() {
Link Here
|
50 |
BOOTPART="${BOOTPART:-/boot}" |
50 |
BOOTPART="${BOOTPART:-/boot}" |
51 |
local img="$(image_path)" initrd="$(initrd_path)" mounted=false initrdopt= |
51 |
local img="$(image_path)" initrd="$(initrd_path)" mounted=false initrdopt= |
52 |
|
52 |
|
53 |
if [[ -z "${img}" ]] || [[ -z "${initrd}" ]]; then |
53 |
if [ -z "${img}" ] || [ -z "${initrd}" ]; then |
54 |
# If we cannot find our image, try mounting ${BOOTPART} |
54 |
# If we cannot find our image, try mounting ${BOOTPART} |
55 |
if ! grep -q " ${BOOTPART} " /proc/mounts; then |
55 |
if ! grep -q " ${BOOTPART} " /proc/mounts; then |
56 |
ebegin "Mounting ${BOOTPART}" |
56 |
ebegin "Mounting ${BOOTPART}" |
Lines 61-67
load_image() {
Link Here
|
61 |
fi |
61 |
fi |
62 |
fi |
62 |
fi |
63 |
|
63 |
|
64 |
if [[ -z "${img}" ]]; then |
64 |
if [ -z "${img}" ]; then |
65 |
eerror "No kernel image found in ${BOOTPART}!" |
65 |
eerror "No kernel image found in ${BOOTPART}!" |
66 |
${mounted} && umount "${BOOTPART}" |
66 |
${mounted} && umount "${BOOTPART}" |
67 |
return 1 |
67 |
return 1 |
Lines 69-80
load_image() {
Link Here
|
69 |
ebegin "Loading kernel image ${img} for kexec" |
69 |
ebegin "Loading kernel image ${img} for kexec" |
70 |
fi |
70 |
fi |
71 |
|
71 |
|
72 |
[[ -n "${ROOTPART}" ]] || \ |
72 |
[ -n "${ROOTPART}" ] || \ |
73 |
ROOTPART="$(readlink -f "$(sed -n '/^\/[^ ]* \/ / s,^\([^ ]*\).*,\1,p' /proc/mounts)")" |
73 |
ROOTPART="$(readlink -f "$(sed -n '/^\/[^ ]* \/ / s,^\([^ ]*\).*,\1,p' /proc/mounts)")" |
74 |
|
74 |
|
75 |
[[ -n "${KPARAM}" ]] || KEXEC_OPT_ARGS+=" --reuse-cmdline" |
75 |
[ -n "${KPARAM}" ] || KEXEC_OPT_ARGS="${KEXEC_OPT_ARGS} --reuse-cmdline" |
76 |
|
76 |
|
77 |
[[ -n "${initrd}" ]] && [[ -e "${initrd}" ]] && initrdopt="--initrd=${initrd}" |
77 |
[ -n "${initrd}" ] && [ -e "${initrd}" ] && initrdopt="--initrd=${initrd}" |
78 |
|
78 |
|
79 |
einfo " Setting kexec with ${KEXEC_OPT_ARGS} -l ${img} root=${ROOTPART} ${KPARAM} ${initrdopt}" |
79 |
einfo " Setting kexec with ${KEXEC_OPT_ARGS} -l ${img} root=${ROOTPART} ${KPARAM} ${initrdopt}" |
80 |
kexec ${KEXEC_OPT_ARGS} -l "${img}" --append="root=${ROOTPART} ${KPARAM}" ${initrdopt} |
80 |
kexec ${KEXEC_OPT_ARGS} -l "${img}" --append="root=${ROOTPART} ${KPARAM}" ${initrdopt} |
Lines 86-92
load_image() {
Link Here
|
86 |
} |
86 |
} |
87 |
|
87 |
|
88 |
start() { |
88 |
start() { |
89 |
if [[ "${LOAD_DURING_SHUTDOWN:-yes}" = "yes" ]]; then |
89 |
if [ "${LOAD_DURING_SHUTDOWN:-yes}" = "yes" ]; then |
90 |
image_path > /dev/null || \ |
90 |
image_path > /dev/null || \ |
91 |
ewarn "Cannot find kernel image. Please make sure a valid kernel image is present before reboot." |
91 |
ewarn "Cannot find kernel image. Please make sure a valid kernel image is present before reboot." |
92 |
return 0 |
92 |
return 0 |
Lines 98-104
start() {
Link Here
|
98 |
} |
98 |
} |
99 |
|
99 |
|
100 |
stop() { |
100 |
stop() { |
101 |
[[ "${LOAD_DURING_SHUTDOWN:-yes}" != "yes" ]] && return 0 |
101 |
[ "${LOAD_DURING_SHUTDOWN:-yes}" != "yes" ] && return 0 |
102 |
|
102 |
|
103 |
if ! yesno $RC_REBOOT; then |
103 |
if ! yesno $RC_REBOOT; then |
104 |
einfo "Not rebooting, so disabling" |
104 |
einfo "Not rebooting, so disabling" |
Lines 106-112
stop() {
Link Here
|
106 |
return 0 |
106 |
return 0 |
107 |
fi |
107 |
fi |
108 |
|
108 |
|
109 |
if [[ -f /nokexec ]]; then |
109 |
if [ -f /nokexec ]; then |
110 |
einfo "Not using kexec during reboot" |
110 |
einfo "Not using kexec during reboot" |
111 |
rm -f /nokexec |
111 |
rm -f /nokexec |
112 |
kexec -u |
112 |
kexec -u |