blob: fc141e9bbbb49f770945be180c94990ba08096cf (
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
|
#!/bin/sh
#
# Copyright (C) 1995 - 1998, Ian A. Murdock <imurdock@debian.org>
# Copyright (C) 1998, 1999, Guy Maor
# Copyright (C) 2002, Matthew Wilcox
# Copyright (C) 2002, 2004, 2005, 2007, Clint Adams
#
# Install the kernel on a Debian Linux system.
#
# This script is called from /usr/src/linux/arch/i386/boot/install.sh.
# If you install it as /sbin/installkernel, you can do a "make install"
# from a generic kernel source tree, and the image will be installed to
# the proper place for Debian GNU/Linux.
set -e
# Parse the command line options
if [ $# -eq 3 ] || [ $# -eq 4 ] ; then
img="$2"
map="$3"
ver="$1"
if [ $# -eq 4 ] && [ -n "$4" ] ; then
dir="$4"
else
dir="/boot"
fi
else
echo "Usage: installkernel <version> <image> <System.map> <directory>"
exit 1
fi
# Create backups of older versions before installing
updatever () {
if [ -f "$dir/$1-$ver" ] ; then
mv "$dir/$1-$ver" "$dir/$1-$ver.old"
fi
cat "$2" > "$dir/$1-$ver"
# This section is for backwards compatibility only
if test -f "$dir/$1" ; then
# The presence of "$dir/$1" is unusual in modern intallations, and
# the results are mostly unused. So only recreate them if they
# already existed.
if test -L "$dir/$1" &&
[ "$(readlink -f ${dir}/${1})" = "${dir}/${1}-${ver}" ]; then
ln -sf "$1-$ver.old" "$dir/$1.old"
ln -sf "$1-$ver" "$dir/$1"
else
mv "$dir/$1" "$dir/$1.old"
cat "$2" > "$dir/$1"
fi
fi
}
if [ "$(basename $img)" = "vmlinux" ] ; then
updatever vmlinux "$img"
else
updatever vmlinuz "$img"
fi
updatever System.map "$map"
config=$(dirname "$map")
config="${config}/.config"
if [ -f "$config" ] ; then
updatever config "$config"
fi
exit 0
|