89 |
mode="" |
mode="" |
90 |
version="" |
version="" |
91 |
initrd="" |
initrd="" |
92 |
|
dracut="" |
93 |
|
dracuthostonly="" |
94 |
initrdfile="" |
initrdfile="" |
95 |
moddep="" |
moddep="" |
96 |
verbose="" |
verbose="" |
98 |
package="" |
package="" |
99 |
mbkernel="" |
mbkernel="" |
100 |
mbargs="" |
mbargs="" |
101 |
|
adddracutargs="" |
102 |
|
addplymouthinitrd="" |
103 |
|
|
104 |
usage() |
usage() |
105 |
{ |
{ |
106 |
echo "Usage: $(basename $0) [-v] [--mkinitrd] [--rminitrd]" >&2 |
echo "Usage: $(basename $0) [-v] [--mkinitrd] [--rminitrd] [--dracut]" >&2 |
107 |
echo " [--initrdfile=<initrd-image>] [--depmod] [--rmmoddep]" >&2 |
echo " [--initrdfile=<initrd-image>] [--depmod] [--rmmoddep]" >&2 |
108 |
echo " [--kernel-args=<args>] [--remove-args=<args>]" >&2 |
echo " [--kernel-args=<args>] [--remove-args=<args>]" >&2 |
109 |
echo " [--banner=<banner>] [--multiboot=multiboot]" >&2 |
echo " [--banner=<banner>] [--multiboot=multiboot]" >&2 |
110 |
echo " [--mbargs=mbargs] [--make-default]" >&2 |
echo " [--mbargs=mbargs] [--make-default] [--add-dracut-args]" >&2 |
111 |
|
echo " [--add-plymouth-initrd]" >&2 |
112 |
|
echo " [--host-only]" >&2 |
113 |
echo " <--install | --remove | --update> <kernel-version>" >&2 |
echo " <--install | --remove | --update> <kernel-version>" >&2 |
114 |
echo " (ex: $(basename $0) --mkinitrd --depmod --install 2.4.7-2)" >&2 |
echo " (ex: $(basename $0) --mkinitrd --depmod --install 2.4.7-2)" >&2 |
115 |
exit 1 |
exit 1 |
117 |
|
|
118 |
run_grub2() |
run_grub2() |
119 |
{ |
{ |
120 |
if [ -d /boot/grub2 -a -x /sbin/grub2-mkconfig ] |
if [ -d /boot/grub -a -x /sbin/grub-mkconfig ] |
121 |
then |
then |
122 |
cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.old |
cp /boot/grub/grub.cfg /boot/grub/grub.cfg.old |
123 |
/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg |
/sbin/grub-mkconfig -o /boot/grub/grub.cfg |
124 |
fi |
fi |
125 |
} |
} |
126 |
|
|
138 |
then |
then |
139 |
[[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby" |
[[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby" |
140 |
INITRD="--initrd ${initrdfile}" |
INITRD="--initrd ${initrdfile}" |
141 |
|
|
142 |
|
if [[ -n ${addplymouthinitrd} ]] |
143 |
|
then |
144 |
|
INITRD="${INITRD} --extra-initrd ${bootPrefix}/initrd-plymouth.img" |
145 |
|
fi |
146 |
fi |
fi |
147 |
|
|
148 |
# FIXME: is this a good heuristic to find out if we're on iSeries? |
# FIXME: is this a good heuristic to find out if we're on iSeries? |
273 |
then |
then |
274 |
[[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby" |
[[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby" |
275 |
INITRD="--initrd ${initrdfile}" |
INITRD="--initrd ${initrdfile}" |
276 |
|
|
277 |
|
if [[ -n ${addplymouthinitrd} ]] |
278 |
|
then |
279 |
|
INITRD="${INITRD} --extra-initrd ${bootPrefix}/initrd-plymouth.img" |
280 |
|
fi |
281 |
fi |
fi |
282 |
|
|
283 |
# Run grub2's configuration update in parallel, if it is installed |
# Run grub2's configuration update in parallel, if it is installed |
320 |
|
|
321 |
mkinitrd() |
mkinitrd() |
322 |
{ |
{ |
323 |
|
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 |
[[ -n ${verbose} ]] && echo "creating initrd ${initrdfile} using ${version}" |
[[ -n ${verbose} ]] && echo "creating initrd ${initrdfile} using ${version}" |
330 |
/sbin/mkinitrd --allow-missing -f ${initrdfile} ${version} |
${tool} |
331 |
rc=$? |
rc=$? |
332 |
if [ ${rc} != 0 ] |
if [ ${rc} != 0 ] |
333 |
then |
then |
366 |
initrd="remove" |
initrd="remove" |
367 |
;; |
;; |
368 |
|
|
369 |
|
--dracut) |
370 |
|
dracut=--dracut |
371 |
|
;; |
372 |
|
|
373 |
|
--host-only) |
374 |
|
dracuthostonly=-H |
375 |
|
;; |
376 |
|
|
377 |
--initrdfile*) |
--initrdfile*) |
378 |
if echo $1 | grep '=' >/dev/null |
if echo $1 | grep '=' >/dev/null |
379 |
then |
then |
457 |
fi |
fi |
458 |
;; |
;; |
459 |
|
|
460 |
|
--add-dracut-args) |
461 |
|
adddracutargs=--add-dracut-args |
462 |
|
;; |
463 |
|
|
464 |
|
--add-plymouth-initrd) |
465 |
|
addplymouthinitrd=--add-plymouth-initrd |
466 |
|
;; |
467 |
|
|
468 |
-v) |
-v) |
469 |
verbose=-v |
verbose=-v |
470 |
;; |
;; |
516 |
if [[ -z ${initrdfile} ]] |
if [[ -z ${initrdfile} ]] |
517 |
then |
then |
518 |
INITRD_NAME_PREFIX="initrd" |
INITRD_NAME_PREFIX="initrd" |
519 |
|
if [[ -n ${dracut} ]] |
520 |
|
then |
521 |
|
INITRD_NAME_PREFIX="initramfs" |
522 |
|
fi |
523 |
|
|
524 |
if [[ $(uname -m) = ia64 ]] |
if [[ $(uname -m) = ia64 ]] |
525 |
then |
then |
530 |
fi |
fi |
531 |
[[ -n ${verbose} ]] && echo "initrdfile is ${initrdfile}" |
[[ -n ${verbose} ]] && echo "initrdfile is ${initrdfile}" |
532 |
|
|
533 |
|
# 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 |
# set this as the default if we have the package and it matches |
# set this as the default if we have the package and it matches |
551 |
if [[ ${mode} = --install ]] && [[ ${UPDATEDEFAULT} = yes ]] && [[ -n ${package} ]] && |
if [[ ${mode} = --install ]] && [[ ${UPDATEDEFAULT} = yes ]] && [[ -n ${package} ]] && |
552 |
[[ -n ${DEFAULTKERNEL} ]] && [[ ${package} = ${DEFAULTKERNEL} ]] |
[[ -n ${DEFAULTKERNEL} ]] && [[ ${package} = ${DEFAULTKERNEL} ]] |