blob: dea576fd8e8f216664a1e30d24d6c0b8e806af14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/kexec-tools/files/kexec.init,v 1.5 2006/01/20 20:39:09 genstef Exp $
depend() {
need checkfs
}
start() {
[ -z "$KNAME" ] && KNAME="bzImage"
[ -z "$BOOTPATH" ] && BOOTPATH="/boot"
[ -z "$BOOTMOUNT" ] && BOOTMOUNT=1
[ -z "$ROOTPART" ] && ROOTPART="`cut -f 1 -d' ' /etc/mtab | grep / | tr '\n' '\t' | cut -f 1`"
[ -z "$KPARAM" ] && KPARAM="`sed -r 's:root=[a-zA-Z0-9/]+\s*::g' /proc/cmdline`"
[ -n "$INITRD" ] && INITRDOPT="--initrd=$INITRD"
if [ "$KNAME" != "-" ]
then
ebegin "Loading kernel $KNAME for Kexec"
MNT=1
LOCS="`cut -f 2 -d' ' /etc/mtab | tr '\n' ' '`"
for x in $LOCS
do
if [ "$x" == "$BOOTPATH" ]
then
MNT=0
fi
done
if [ $MNT -eq 1 -a $BOOTMOUNT -eq 1 ]
then
/bin/mount $BOOTPATH
if [ $? -ne 0 ]
then
eerror "Couldn't mount $BOOTPART"
MNT="0"
fi
fi
kexec -l $BOOTPATH/$KNAME --append="root=$ROOTPART $KPARAM" $INITRDOPT
RES=$?
if [ $MNT -eq 1 -a $BOOTMOUNT -eq 1 ]
then
/bin/umount $BOOTPATH
if [ $? -ne 0 ]; then
eerror "Couldn't umount $BOOTPART"
fi
fi
else
ebegin "Disabling kexec"
kexec -u
RES=$?
fi
eend $RES
}
|