blob: cd2b39965cfbba27083c07fea43556becbec36a8 (
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
#!/bin/sh
#--------------------------------------------------------------------
# Copyright (C) 2000, 2002 by Mandriva,
# Chmouel Boudjnah <chmouel@mandriva.com>,
# Redistribution of this file is permitted under the terms of the GNU
# Public License (GPL)
#--------------------------------------------------------------------
# $Id: installkernel 31366 2006-05-11 12:45:38Z tvignaud $
#--------------------------------------------------------------------
## description:
# Install a kernel to /boot and add an entry for grub,
# lilo, or yaboot
# /etc/sysconfig/installkernel variables
NOLINK=""
NOENTRY=""
INITRDOPTS=""
# deprecated /etc/sysconfig/installkernel variables
NOLAUNCH=""
# local variables
action="add-kernel"
no_initrd=
if [ -f /etc/sysconfig/installkernel ];then
source /etc/sysconfig/installkernel
fi
export PATH=$PATH:/sbin:/usr/sbin
function do_load_loop_module () {
modprobe loop 2> /dev/null > /dev/null
}
function usage () {
cat << EOF >&2
Usage: ${0##*/} -[NRLh] KERNEL_VERSION [BOOTIMAGE MAPFILE [BOOTDIR]]
-N: Don't add entry to bootloader
-R: Remove bootloader entry and prepare to remove kernel
-L: Don't do link to default /boot/vmlinuz and /boot/System.map
-C: use cramfs for initrd.
-h: This help.
EOF
exit 2
}
while getopts algyNdnRsSCiLch opt
do
case "$opt" in
a) ;; # was autodetect
s) ;; # was CREATE_LINK_SOURCE
S) ;; # was REMOVE_LINK_SOURCE
N) NOENTRY="yes";;
n) NOLAUNCH="yes";;
R) action="remove-kernel";;
i) no_initrd="yes";;
L) NOLINK="yes";;
c) ;; # was NOCOPY
C) INITRDOPTS=$INITRDOPTS" --initrdfs=cramfs";;
h) usage;;
*) usage;;
esac
done
shift $((OPTIND - 1))
version=$1
if [ $# = 3 -o $# = 4 ]; then
vmlinuz=$2
map_file=$3
[ -n "$4" ] && boot=$4 || boot=/boot
NOLINK="yes"
cp -f $vmlinuz $boot/vmlinuz-$version
cp -f $map_file $boot/System.map-$version
rm -f $boot/initrd-$version.img #- force rebuilding the initrd
config=.config
[ -f $config ] || config=../../../.config
[ -f $config ] && cp -f $config $boot/config-$version
if [ ! -d /lib/modules/$version ]; then
echo "no modules installed, so not building initrd (maybe you should run \"make modules_install\" first)"
exit 0
fi
elif [ $# != 1 ]; then
usage
fi
# this is for backward compatibility
# don't use AUTOREMOVE anymore
[ "$AUTOREMOVE" = "no" ] && NOENTRY="yes"
[ -z "$DURING_INSTALL" ] || exit 0
[ "$action" = "remove-kernel" ] && do_load_loop_module
options="--action $action"
[ -z "$NOLINK" ] || options="--no-short-name $options"
[ -z "$NOENTRY" ] || options="--no-entry $options"
[ -z "$NOLAUNCH" ] || options="--no-launch $options"
[ -z "$NOINITRD" ] || options="--no-initrd $options"
if [ -x /usr/sbin/bootloader-config ]; then
bootloader-config --kernel-version $version --initrd-options "$INITRDOPTS" $options
fi
|