Annotation of /trunk/grubby/installkernel
Parent Directory | Revision Log
Revision 1749 -
(hide annotations)
(download)
Sat Feb 18 01:09:18 2012 UTC (12 years, 8 months ago) by niro
File size: 2683 byte(s)
Sat Feb 18 01:09:18 2012 UTC (12 years, 8 months ago) by niro
File size: 2683 byte(s)
Fix hard coded paths so kernel's "make install" will DTRT.
1 | niro | 1311 | #! /bin/bash |
2 | niro | 532 | # |
3 | niro | 1311 | # /sbin/installkernel |
4 | niro | 532 | # |
5 | niro | 1311 | # Copyright 2007-2008 Red Hat, Inc. All rights reserved. |
6 | # | ||
7 | # This program is free software; you can redistribute it and/or modify | ||
8 | # it under the terms of the GNU General Public License as published by | ||
9 | # the Free Software Foundation; either version 2 of the License, or | ||
10 | # (at your option) any later version. | ||
11 | # | ||
12 | # This program is distributed in the hope that it will be useful, | ||
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | # GNU General Public License for more details. | ||
16 | # | ||
17 | # You should have received a copy of the GNU General Public License | ||
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | # | ||
20 | # Author(s): tyson@rwii.com | ||
21 | # | ||
22 | niro | 532 | |
23 | niro | 1311 | usage() |
24 | { | ||
25 | echo "Usage: $(basename $0) <kernel_version> <bootimage> <mapfile>" >&2 | ||
26 | exit 1 | ||
27 | niro | 532 | } |
28 | |||
29 | cfgLoader= | ||
30 | |||
31 | niro | 1311 | if [[ -z ${INSTALL_PATH} ]] || [[ ${INSTALL_PATH} = /boot ]] |
32 | then | ||
33 | INSTALL_PATH=/boot | ||
34 | cfgLoader=1 | ||
35 | niro | 532 | fi |
36 | |||
37 | niro | 1311 | LINK_PATH=/boot |
38 | RELATIVE_PATH=$(echo "${INSTALL_PATH}/" | sed "s|^${LINK_PATH}/||") | ||
39 | niro | 532 | KERNEL_VERSION=$1 |
40 | BOOTIMAGE=$2 | ||
41 | MAPFILE=$3 | ||
42 | ARCH=$(uname -m) | ||
43 | niro | 1311 | if [[ ${ARCH} = ppc64 ]] || [[ ${ARCH} = ppc ]] |
44 | then | ||
45 | KERNEL_NAME=kernel | ||
46 | niro | 532 | else |
47 | niro | 1311 | KERNEL_NAME=kernel |
48 | niro | 532 | fi |
49 | |||
50 | niro | 1311 | if [[ -z ${KERNEL_VERSION} ]] || [[ -z ${BOOTIMAGE} ]] || [[ -z ${MAPFILE} ]] |
51 | then | ||
52 | usage | ||
53 | niro | 532 | fi |
54 | |||
55 | niro | 1311 | if [[ -f ${INSTALL_PATH}/${KERNEL_NAME}-${KERNEL_VERSION} ]] |
56 | then | ||
57 | mv ${INSTALL_PATH}/${KERNEL_NAME}-${KERNEL_VERSION} \ | ||
58 | ${INSTALL_PATH}/${KERNEL_NAME}-${KERNEL_VERSION}.old | ||
59 | niro | 532 | fi |
60 | |||
61 | niro | 1311 | if [ ! -L ${INSTALL_PATH}/${KERNEL_NAME} ] |
62 | then | ||
63 | if [ -e ${INSTALLPATH}/${KERNEL_NAME} ] | ||
64 | then | ||
65 | mv ${INSTALL_PATH}/${KERNEL_NAME} ${INSTALL_PATH}/${KERNEL_NAME}.old | ||
66 | fi | ||
67 | niro | 532 | fi |
68 | |||
69 | niro | 1311 | if [ -f ${INSTALL_PATH}/System.map-${KERNEL_VERSION} ] |
70 | then | ||
71 | mv ${INSTALL_PATH}/System.map-${KERNEL_VERSION} \ | ||
72 | ${INSTALL_PATH}/System.map-${KERNEL_VERSION}.old | ||
73 | niro | 532 | fi |
74 | |||
75 | niro | 1311 | if [ ! -L ${INSTALL_PATH}/System.map ] |
76 | then | ||
77 | if [ -e ${INSTALLPATH}/System.map ] | ||
78 | then | ||
79 | mv ${INSTALL_PATH}/System.map ${INSTALL_PATH}/System.map.old | ||
80 | fi | ||
81 | niro | 532 | fi |
82 | niro | 1311 | ln -sf ${RELATIVE_PATH}${INSTALL_PATH}/System.map-${KERNEL_VERSION} ${LINK_PATH}/System.map |
83 | niro | 532 | |
84 | niro | 1311 | cat ${BOOTIMAGE} > ${INSTALL_PATH}/${KERNEL_NAME}-${KERNEL_VERSION} |
85 | cp ${MAPFILE} ${INSTALL_PATH}/System.map-${KERNEL_VERSION} | ||
86 | niro | 532 | |
87 | niro | 1311 | ln -fs ${RELATIVE_PATH}${INSTALL_PATH}/${KERNEL_NAME}-${KERNEL_VERSION} ${LINK_PATH}/${KERNEL_NAME} |
88 | ln -fs ${RELATIVE_PATH}${INSTALL_PATH}/System.map-${KERNEL_VERSION} ${LINK_PATH}/System.map | ||
89 | niro | 532 | |
90 | niro | 1311 | if [[ -n ${cfgLoader} ]] && [[ -x /sbin/new-kernel-pkg ]] |
91 | then | ||
92 | niro | 1749 | if [ -n "$(which dracut 2>/dev/null)" ] |
93 | niro | 1340 | then |
94 | niro | 1749 | new-kernel-pkg --mkinitrd --dracut --host-only --depmod --install ${KERNEL_VERSION} |
95 | niro | 1340 | else |
96 | niro | 1749 | new-kernel-pkg --mkinitrd --depmod --install ${KERNEL_VERSION} |
97 | niro | 1340 | fi |
98 | niro | 532 | fi |
Properties
Name | Value |
---|---|
svn:executable | * |