Annotation of /trunk/grubby/new-kernel-pkg
Parent Directory | Revision Log
Revision 1431 -
(hide annotations)
(download)
Tue Jul 19 17:02:36 2011 UTC (13 years, 3 months ago) by niro
File size: 13629 byte(s)
Tue Jul 19 17:02:36 2011 UTC (13 years, 3 months ago) by niro
File size: 13629 byte(s)
-we install grub2 without '2' suffix
1 | niro | 532 | #!/bin/bash |
2 | niro | 924 | # $Id$ |
3 | niro | 532 | # |
4 | niro | 923 | # new-kernel-pkg |
5 | niro | 532 | # Invoked upon installation or removal of a kernel package, the following |
6 | # tasks are/can be done here: | ||
7 | # creation/removal of initrd | ||
8 | # run of depmod/removal of depmod generated files | ||
9 | # addition/removal of kernel images from grub/lilo configuration (via grubby) | ||
10 | # | ||
11 | niro | 923 | # Copyright 2002-2008 Red Hat, Inc. All rights reserved. |
12 | niro | 532 | # modified for Magellan-Linux by Niels Rogalla <niro@magellan-linux.de> |
13 | # | ||
14 | niro | 923 | # This program is free software; you can redistribute it and/or modify |
15 | # it under the terms of the GNU General Public License as published by | ||
16 | # the Free Software Foundation; either version 2 of the License, or | ||
17 | # (at your option) any later version. | ||
18 | # | ||
19 | # This program is distributed in the hope that it will be useful, | ||
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | # GNU General Public License for more details. | ||
23 | # | ||
24 | # You should have received a copy of the GNU General Public License | ||
25 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
26 | # | ||
27 | niro | 532 | |
28 | PATH=/sbin:/bin:$PATH | ||
29 | |||
30 | lilo=/sbin/lilo | ||
31 | |||
32 | # some defaults that are sane for most arches | ||
33 | kernelName=kernel | ||
34 | |||
35 | niro | 924 | if [ -x ./grubby ] |
36 | then | ||
37 | grubby=./grubby | ||
38 | niro | 532 | else |
39 | niro | 924 | grubby=/sbin/grubby |
40 | niro | 532 | fi |
41 | |||
42 | niro | 925 | [ -f /etc/conf.d/grubby ] && . /etc/conf.d/grubby |
43 | niro | 532 | |
44 | cfgGrub="" | ||
45 | cfgLilo="" | ||
46 | runLilo="" | ||
47 | grubConfig="" | ||
48 | |||
49 | ARCH=$(uname -m) | ||
50 | |||
51 | niro | 924 | if [[ ${ARCH} = ia64 ]] |
52 | then | ||
53 | liloConfig=/boot/efi/EFI/redhat/elilo.conf | ||
54 | bootPrefix=/boot/efi/EFI/redhat | ||
55 | liloFlag=elilo | ||
56 | isx86="" | ||
57 | elif [[ ${ARCH} = ppc64 ]] || [[ ${ARCH} = ppc ]] | ||
58 | then | ||
59 | liloConfig=/etc/yaboot.conf | ||
60 | bootPrefix=/boot | ||
61 | lilo=/sbin/ybin | ||
62 | liloFlag=yaboot | ||
63 | runLilo="yes" | ||
64 | isx86="" | ||
65 | elif [[ ${ARCH} = sparc ]] || [[ ${ARCH} = sparc64 ]] | ||
66 | then | ||
67 | liloConfig=/etc/silo.conf | ||
68 | bootPrefix=/boot | ||
69 | liloFlag=silo | ||
70 | lilo=/sbin/silo | ||
71 | isx86="" | ||
72 | elif [[ ${ARCH} = s390 ]] || [[ ${ARCH} = s390x ]] | ||
73 | then | ||
74 | liloConfig=/etc/zipl.conf | ||
75 | bootPrefix=/boot | ||
76 | liloFlag=zipl | ||
77 | lilo=/sbin/zipl | ||
78 | runLilo="yes" | ||
79 | isx86="" | ||
80 | niro | 532 | else |
81 | niro | 924 | # this leaves i?86 and x86_64 |
82 | liloConfig=/etc/lilo.conf | ||
83 | grubConfig=/boot/grub/grub.conf | ||
84 | bootPrefix=/boot | ||
85 | liloFlag=lilo | ||
86 | isx86="yes" | ||
87 | niro | 532 | fi |
88 | |||
89 | mode="" | ||
90 | version="" | ||
91 | initrd="" | ||
92 | niro | 1334 | dracut="" |
93 | dracuthostonly="" | ||
94 | niro | 532 | initrdfile="" |
95 | moddep="" | ||
96 | verbose="" | ||
97 | makedefault="" | ||
98 | package="" | ||
99 | mbkernel="" | ||
100 | mbargs="" | ||
101 | niro | 1334 | adddracutargs="" |
102 | addplymouthinitrd="" | ||
103 | niro | 532 | |
104 | niro | 924 | usage() |
105 | { | ||
106 | niro | 1334 | echo "Usage: $(basename $0) [-v] [--mkinitrd] [--rminitrd] [--dracut]" >&2 |
107 | niro | 924 | echo " [--initrdfile=<initrd-image>] [--depmod] [--rmmoddep]" >&2 |
108 | niro | 1305 | echo " [--kernel-args=<args>] [--remove-args=<args>]" >&2 |
109 | niro | 924 | echo " [--banner=<banner>] [--multiboot=multiboot]" >&2 |
110 | niro | 1334 | echo " [--mbargs=mbargs] [--make-default] [--add-dracut-args]" >&2 |
111 | echo " [--add-plymouth-initrd]" >&2 | ||
112 | echo " [--host-only]" >&2 | ||
113 | niro | 924 | echo " <--install | --remove | --update> <kernel-version>" >&2 |
114 | echo " (ex: $(basename $0) --mkinitrd --depmod --install 2.4.7-2)" >&2 | ||
115 | exit 1 | ||
116 | niro | 532 | } |
117 | |||
118 | niro | 1305 | run_grub2() |
119 | { | ||
120 | niro | 1431 | if [ -d /boot/grub -a -x /sbin/grub-mkconfig ] |
121 | niro | 1305 | then |
122 | niro | 1431 | cp /boot/grub/grub.cfg /boot/grub/grub.cfg.old |
123 | /sbin/grub-mkconfig -o /boot/grub/grub.cfg | ||
124 | niro | 1305 | fi |
125 | } | ||
126 | |||
127 | niro | 924 | install() |
128 | { | ||
129 | # XXX kernel should be able to be specified also (or work right on ia64) | ||
130 | if [ ! -f ${bootPrefix}/${kernelName}-${version} ] | ||
131 | then | ||
132 | [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby" | ||
133 | return | ||
134 | fi | ||
135 | niro | 923 | |
136 | niro | 924 | INITRD="" |
137 | if [ -f ${initrdfile} ] | ||
138 | then | ||
139 | [[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby" | ||
140 | INITRD="--initrd ${initrdfile}" | ||
141 | niro | 1334 | |
142 | if [[ -n ${addplymouthinitrd} ]] | ||
143 | then | ||
144 | INITRD="${INITRD} --extra-initrd ${bootPrefix}/initrd-plymouth.img" | ||
145 | fi | ||
146 | niro | 924 | fi |
147 | niro | 532 | |
148 | niro | 924 | # FIXME: is this a good heuristic to find out if we're on iSeries? |
149 | if [ -d /proc/iSeries ] | ||
150 | then | ||
151 | [[ -n ${verbose} ]] && echo "On an iSeries, just making img file" | ||
152 | if [[ -z ${initrdfile} ]] | ||
153 | then | ||
154 | [[ -n ${verbose} ]] && echo "No initrd, just adding system map" | ||
155 | /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${bootPrefix}/${kernelName}-${version} ${bootPrefix}/vmlinitrd-${version} | ||
156 | else | ||
157 | /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${bootPrefix}/${kernelName}-${version} ${bootPrefix}/vmlinux.sm-${version} | ||
158 | /sbin/addRamDisk ${initrdfile} ${bootPrefix}/System.map-${version} ${bootPrefix}/vmlinux.sm-${version} ${bootPrefix}/vmlinitrd-${version} 2>/dev/null | ||
159 | rm ${bootPrefix}/vmlinux.sm-${version} | ||
160 | fi | ||
161 | return | ||
162 | niro | 532 | fi |
163 | |||
164 | niro | 1305 | # Run grub2's configuration update in parallel, if it is installed |
165 | run_grub2 | ||
166 | |||
167 | niro | 924 | # get the root filesystem to use |
168 | rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab) | ||
169 | niro | 532 | |
170 | niro | 924 | if [[ -n ${mbkernel} ]] && [[ -n ${cfgLilo} ]] && [[ ${liloFlag} != elilo ]] |
171 | then | ||
172 | [[ -n ${verbose} ]] && echo "multiboot specified, not updating lilo.conf" | ||
173 | cfgLilo="" | ||
174 | fi | ||
175 | niro | 532 | |
176 | niro | 924 | if [[ -n ${cfgGrub} ]] |
177 | then | ||
178 | [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}" | ||
179 | niro | 532 | |
180 | niro | 924 | if [[ -n ${banner} ]] |
181 | then | ||
182 | title="${banner} (${version})" | ||
183 | elif [ -f /etc/mageversion ] | ||
184 | then | ||
185 | title="Magellan Linux $(< /etc/mageversion) (${version})" | ||
186 | else | ||
187 | title="Magellan Linux (${version})" | ||
188 | fi | ||
189 | ${grubby} --add-kernel=${bootPrefix}/${kernelName}-${version} \ | ||
190 | ${INITRD} --copy-default ${makedefault} --title "${title}" \ | ||
191 | ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \ | ||
192 | --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}" | ||
193 | niro | 532 | else |
194 | niro | 924 | [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby" |
195 | niro | 532 | fi |
196 | |||
197 | niro | 924 | if [[ -n ${cfgLilo} ]] |
198 | then | ||
199 | [[ -n ${verbose} ]] && echo "adding ${version} to ${liloConfig}" | ||
200 | niro | 532 | |
201 | niro | 924 | ${grubby} --add-kernel=${bootPrefix}/${kernelName}-${version} ${INITRD} \ |
202 | --copy-default ${makedefault} --title ${version} \ | ||
203 | ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \ | ||
204 | --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${version}" \ | ||
205 | --${liloFlag} | ||
206 | niro | 532 | |
207 | niro | 924 | if [[ -n ${runLilo} ]] |
208 | then | ||
209 | [[ -n ${verbose} ]] && echo "running ${lilo}" | ||
210 | niro | 1305 | if [ ! -x ${lilo} ] |
211 | niro | 924 | then |
212 | [[ -n ${verbose} ]] && echo "${lilo} does not exist" | ||
213 | else | ||
214 | ${lilo} > /dev/null | ||
215 | fi | ||
216 | fi | ||
217 | else | ||
218 | [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby" | ||
219 | niro | 532 | fi |
220 | } | ||
221 | |||
222 | niro | 924 | remove() |
223 | { | ||
224 | # FIXME: is this a good heuristic to find out if we're on iSeries? | ||
225 | if [ -d /proc/iSeries ] | ||
226 | then | ||
227 | [[ -n ${verbose} ]] && echo "On an iSeries, remove img file" | ||
228 | rm -f ${bootPrefix}/${kernelName}-${version}.img 2>/dev/null | ||
229 | return | ||
230 | fi | ||
231 | niro | 532 | |
232 | niro | 1305 | # Run grub2's configuration update in parallel, if it is installed |
233 | run_grub2 | ||
234 | |||
235 | niro | 924 | if [[ -n ${cfgGrub} ]] |
236 | then | ||
237 | [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}" | ||
238 | ${grubby} --remove-kernel=${bootPrefix}/${kernelName}-${version} | ||
239 | else | ||
240 | [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby" | ||
241 | fi | ||
242 | niro | 532 | |
243 | niro | 924 | if [[ -n ${cfgLilo} ]] |
244 | then | ||
245 | [[ -n ${verbose} ]] && echo "removing ${version} from ${liloConfig}" | ||
246 | niro | 1305 | ${grubby} --remove-kernel=${bootPrefix}/${kernelName}-${version} --${liloFlag} |
247 | niro | 532 | |
248 | niro | 924 | if [[ -n ${runLilo} ]] |
249 | then | ||
250 | [[ -n ${verbose} ]] && echo "running ${lilo}" | ||
251 | if [ ! -x ${lilo} ] | ||
252 | then | ||
253 | [[ -n ${verbose} ]] && echo "${lilo} does not exist" | ||
254 | else | ||
255 | ${lilo} > /dev/null | ||
256 | fi | ||
257 | fi | ||
258 | else | ||
259 | [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby" | ||
260 | niro | 532 | fi |
261 | } | ||
262 | |||
263 | niro | 924 | update() |
264 | { | ||
265 | niro | 1305 | if [ ! -f ${bootPrefix}/${kernelName}-${version} ] |
266 | then | ||
267 | [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby" | ||
268 | return | ||
269 | fi | ||
270 | |||
271 | INITRD="" | ||
272 | if [ -f ${initrdfile} ] | ||
273 | then | ||
274 | [[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby" | ||
275 | INITRD="--initrd ${initrdfile}" | ||
276 | niro | 1334 | |
277 | if [[ -n ${addplymouthinitrd} ]] | ||
278 | then | ||
279 | INITRD="${INITRD} --extra-initrd ${bootPrefix}/initrd-plymouth.img" | ||
280 | fi | ||
281 | niro | 1305 | fi |
282 | |||
283 | # Run grub2's configuration update in parallel, if it is installed | ||
284 | run_grub2 | ||
285 | |||
286 | niro | 924 | if [[ -n ${cfgGrub} ]] |
287 | then | ||
288 | [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}" | ||
289 | ${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \ | ||
290 | niro | 1305 | ${INITRD} \ |
291 | niro | 924 | ${kernargs:+--args="${kernargs}"} \ |
292 | ${removeargs:+--remove-args="${removeargs}"} | ||
293 | else | ||
294 | [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby" | ||
295 | fi | ||
296 | niro | 923 | |
297 | niro | 924 | if [[ -n ${cfgLilo} ]] |
298 | then | ||
299 | [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}" | ||
300 | ${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \ | ||
301 | niro | 1305 | ${INITRD} \ |
302 | niro | 924 | ${kernargs:+--args="${kernargs}"} \ |
303 | ${removeargs:+--remove-args="${removeargs}"} \ | ||
304 | --${liloFlag} | ||
305 | niro | 923 | |
306 | niro | 924 | if [[ -n ${runLilo} ]] |
307 | then | ||
308 | [[ -n ${verbose} ]] && echo "running ${lilo}" | ||
309 | if [ ! -x ${lilo} ] | ||
310 | then | ||
311 | [[ -n ${verbose} ]] && echo "${lilo} does not exist" | ||
312 | else | ||
313 | ${lilo} > /dev/null | ||
314 | fi | ||
315 | fi | ||
316 | else | ||
317 | [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby" | ||
318 | niro | 923 | fi |
319 | } | ||
320 | |||
321 | niro | 924 | mkinitrd() |
322 | { | ||
323 | niro | 1334 | if [[ -n ${dracut} ]] |
324 | then | ||
325 | tool="/sbin/dracut ${dracuthostonly} -f ${initrdfile} ${version}" | ||
326 | else | ||
327 | tool="/sbin/mkinitrd --allow-missing -f ${initrdfile} ${version}" | ||
328 | fi | ||
329 | niro | 924 | [[ -n ${verbose} ]] && echo "creating initrd ${initrdfile} using ${version}" |
330 | niro | 1334 | ${tool} |
331 | niro | 924 | rc=$? |
332 | if [ ${rc} != 0 ] | ||
333 | then | ||
334 | echo "mkinitrd failed" >&2 | ||
335 | exit 1 | ||
336 | fi | ||
337 | niro | 532 | } |
338 | |||
339 | niro | 924 | rminitrd() |
340 | { | ||
341 | [[ -n ${verbose} ]] && echo "removing initrd ${initrdfile}" | ||
342 | [ -f ${initrdfile} ] && rm -f ${initrdfile} | ||
343 | niro | 532 | } |
344 | |||
345 | niro | 924 | doDepmod() |
346 | { | ||
347 | [[ -n ${verbose} ]] && echo "running depmod for ${version}" | ||
348 | depmod -ae -F /boot/System.map-${version} ${version} | ||
349 | niro | 532 | } |
350 | |||
351 | niro | 924 | doRmmoddep() |
352 | { | ||
353 | [[ -n ${verbose} ]] && echo "removing modules.dep info for ${version}" | ||
354 | [ -d /lib/modules/${version} ] && rm -f /lib/modules/${version}/modules.* | ||
355 | niro | 532 | } |
356 | |||
357 | |||
358 | niro | 924 | while [ $# -gt 0 ] |
359 | do | ||
360 | case $1 in | ||
361 | --mkinitrd) | ||
362 | initrd="make" | ||
363 | ;; | ||
364 | niro | 532 | |
365 | niro | 924 | --rminitrd) |
366 | initrd="remove" | ||
367 | ;; | ||
368 | niro | 532 | |
369 | niro | 1334 | --dracut) |
370 | dracut=--dracut | ||
371 | ;; | ||
372 | |||
373 | --host-only) | ||
374 | dracuthostonly=-H | ||
375 | ;; | ||
376 | |||
377 | niro | 924 | --initrdfile*) |
378 | if echo $1 | grep '=' >/dev/null | ||
379 | then | ||
380 | initrdfile=$(echo $1 | sed 's/^--initrdfile=//') | ||
381 | else | ||
382 | initrdfile=$2 | ||
383 | shift | ||
384 | fi | ||
385 | ;; | ||
386 | niro | 532 | |
387 | niro | 924 | --kernel-args*) |
388 | if echo $1 | grep '=' >/dev/null | ||
389 | then | ||
390 | kernargs=$(echo $1 | sed 's/^--kernel-args=//') | ||
391 | else | ||
392 | kernargs=$2 | ||
393 | shift | ||
394 | fi | ||
395 | ;; | ||
396 | niro | 532 | |
397 | niro | 924 | --remove-args*) |
398 | if echo $1 | grep '=' >/dev/null | ||
399 | then | ||
400 | niro | 1305 | removeargs=$(echo $1 | sed 's/^--remove-args=//') |
401 | niro | 924 | else |
402 | removeargs=$2 | ||
403 | shift | ||
404 | fi | ||
405 | ;; | ||
406 | niro | 923 | |
407 | niro | 924 | --banner*) |
408 | if echo $1 | grep '=' >/dev/null | ||
409 | then | ||
410 | banner=$(echo $1 | sed 's/^--banner=//') | ||
411 | else | ||
412 | banner=$2 | ||
413 | shift | ||
414 | fi | ||
415 | ;; | ||
416 | niro | 532 | |
417 | niro | 924 | --multiboot*) |
418 | if echo $1 |grep '=' >/dev/null | ||
419 | then | ||
420 | mbkernel=$(echo $1 | sed 's/^--multiboot=//') | ||
421 | else | ||
422 | # can't really support having an optional second arg here | ||
423 | # sorry! | ||
424 | mbkernel="/boot/xen.gz" | ||
425 | fi | ||
426 | ;; | ||
427 | niro | 532 | |
428 | niro | 924 | --mbargs*) |
429 | if echo $1 |grep '=' >/dev/null | ||
430 | then | ||
431 | mbargs=$(echo $1 | sed 's/^--mbargs=//') | ||
432 | else | ||
433 | mbargs="$2" | ||
434 | shift | ||
435 | fi | ||
436 | ;; | ||
437 | niro | 532 | |
438 | niro | 924 | --depmod) |
439 | moddep="make" | ||
440 | ;; | ||
441 | niro | 532 | |
442 | niro | 924 | --rmmoddep) |
443 | moddep="remove" | ||
444 | ;; | ||
445 | niro | 532 | |
446 | niro | 924 | --make-default) |
447 | makedefault="--make-default" | ||
448 | ;; | ||
449 | niro | 532 | |
450 | niro | 924 | --package) |
451 | if echo $1 | grep '=' >/dev/null | ||
452 | then | ||
453 | package=$(echo $1 | sed 's/^--package=//') | ||
454 | else | ||
455 | package=$2 | ||
456 | shift | ||
457 | fi | ||
458 | ;; | ||
459 | niro | 532 | |
460 | niro | 1334 | --add-dracut-args) |
461 | adddracutargs=--add-dracut-args | ||
462 | ;; | ||
463 | |||
464 | --add-plymouth-initrd) | ||
465 | addplymouthinitrd=--add-plymouth-initrd | ||
466 | ;; | ||
467 | |||
468 | niro | 924 | -v) |
469 | verbose=-v | ||
470 | ;; | ||
471 | niro | 532 | |
472 | niro | 924 | *) |
473 | if [[ -z ${mode} ]] | ||
474 | then | ||
475 | mode=$1 | ||
476 | elif [[ -z ${version} ]] | ||
477 | then | ||
478 | version=$1 | ||
479 | else | ||
480 | usage | ||
481 | fi | ||
482 | ;; | ||
483 | esac | ||
484 | niro | 532 | |
485 | niro | 924 | shift |
486 | niro | 532 | done |
487 | |||
488 | # make sure the mode is valid | ||
489 | niro | 924 | if [[ ${mode} != --install ]] && [[ ${mode} != --remove ]] && [[ ${mode} != --update ]] |
490 | then | ||
491 | usage | ||
492 | niro | 532 | fi |
493 | |||
494 | niro | 924 | if [[ -z ${version} ]] |
495 | then | ||
496 | usage | ||
497 | niro | 532 | fi |
498 | |||
499 | niro | 924 | if [ "${mode}" != "--install" -a "${makedefault}" ] |
500 | then | ||
501 | usage | ||
502 | niro | 532 | fi |
503 | |||
504 | niro | 924 | kernelmajor=$(echo ${kernel} | cut -d . -f 1,2) |
505 | niro | 532 | |
506 | niro | 1305 | # kernel image for 2.4 is kernel |
507 | niro | 924 | if [[ ${ARCH} = ppc64 ]] || [[ ${ARCH} = ppc ]] |
508 | then | ||
509 | if [[ ${kernelmajor} = 2.4 ]] | ||
510 | then | ||
511 | kernelName=kernel | ||
512 | fi | ||
513 | niro | 532 | fi |
514 | |||
515 | # set the initrd file based on arch; ia64 is the only currently known oddball | ||
516 | niro | 924 | if [[ -z ${initrdfile} ]] |
517 | then | ||
518 | INITRD_NAME_PREFIX="initrd" | ||
519 | niro | 1334 | if [[ -n ${dracut} ]] |
520 | then | ||
521 | INITRD_NAME_PREFIX="initramfs" | ||
522 | fi | ||
523 | niro | 923 | |
524 | niro | 924 | if [[ $(uname -m) = ia64 ]] |
525 | then | ||
526 | initrdfile="/boot/efi/EFI/redhat/${INITRD_NAME_PREFIX}-${version}.img" | ||
527 | else | ||
528 | initrdfile="/boot/${INITRD_NAME_PREFIX}-${version}.img" | ||
529 | fi | ||
530 | niro | 532 | fi |
531 | niro | 924 | [[ -n ${verbose} ]] && echo "initrdfile is ${initrdfile}" |
532 | niro | 532 | |
533 | niro | 1334 | # add dracut i18n, keyboard and plymouth kernel args if requested |
534 | if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]] | ||
535 | then | ||
536 | [ -r /etc/conf.d/keymap ] && . /etc/conf.d/keymap | ||
537 | [ -r /etc/conf.d/consolefont ] && . /etc/conf.d/consolefont | ||
538 | |||
539 | if [[ -n ${KEYMAP} ]] | ||
540 | then | ||
541 | kernargs="${kernargs} KEYTABLE=${KEYMAP}" | ||
542 | fi | ||
543 | |||
544 | if [[ -n ${CONSOLEFONT} ]] | ||
545 | then | ||
546 | kernargs="${kernargs} SYSFONT=${CONSOLEFONT}" | ||
547 | fi | ||
548 | fi | ||
549 | |||
550 | niro | 532 | # set this as the default if we have the package and it matches |
551 | niro | 924 | if [[ ${mode} = --install ]] && [[ ${UPDATEDEFAULT} = yes ]] && [[ -n ${package} ]] && |
552 | [[ -n ${DEFAULTKERNEL} ]] && [[ ${package} = ${DEFAULTKERNEL} ]] | ||
553 | then | ||
554 | makedefault="--make-default" | ||
555 | [[ -n ${verbose} ]] && echo "making it the default based on config" | ||
556 | niro | 532 | fi |
557 | |||
558 | niro | 924 | if [[ ${moddep} = make ]] |
559 | then | ||
560 | doDepmod | ||
561 | elif [[ ${moddep} = remove ]] | ||
562 | then | ||
563 | doRmmoddep | ||
564 | niro | 532 | fi |
565 | |||
566 | niro | 924 | if [[ ${initrd} = make ]] |
567 | then | ||
568 | mkinitrd | ||
569 | elif [[ ${initrd} = remove ]] | ||
570 | then | ||
571 | rminitrd | ||
572 | niro | 532 | fi |
573 | |||
574 | niro | 924 | if [ ! -x ${grubby} ] |
575 | then | ||
576 | [[ -n ${verbose} ]] && echo "${grubby} does not exist" | ||
577 | exit 0 | ||
578 | niro | 532 | fi |
579 | |||
580 | niro | 924 | [[ -n ${grubConfig} ]] && [ -f ${grubConfig} ] && cfgGrub=1 |
581 | [[ -n ${liloConfig} ]] && [ -f ${liloConfig} ] && cfgLilo=1 | ||
582 | niro | 532 | |
583 | # if we have a lilo config on an x86 box, see if the default boot loader | ||
584 | # is lilo to determine if it should be run | ||
585 | niro | 924 | if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]] |
586 | then | ||
587 | runLilo=$(${grubby} --bootloader-probe | grep lilo) | ||
588 | niro | 532 | fi |
589 | |||
590 | niro | 924 | if [[ ${mode} = --install ]] |
591 | then | ||
592 | install | ||
593 | elif [[ ${mode} = --remove ]] | ||
594 | then | ||
595 | remove | ||
596 | elif [[ ${mode} = --update ]] | ||
597 | then | ||
598 | update | ||
599 | niro | 532 | fi |
600 | |||
601 | exit 0 |
Properties
Name | Value |
---|---|
svn:executable | * |