25 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
26 |
# |
# |
27 |
|
|
28 |
|
read_os_release() |
29 |
|
{ |
30 |
|
local NAME |
31 |
|
local ID |
32 |
|
local Version |
33 |
|
local Version_ID |
34 |
|
local PRETTY_NAME |
35 |
|
local ANSI_COLOR |
36 |
|
local CPE_NAME |
37 |
|
|
38 |
|
if [[ -f /etc/os-release ]] |
39 |
|
then |
40 |
|
source /etc/os-release |
41 |
|
|
42 |
|
case $1 in |
43 |
|
name) echo "${NAME}" ;; |
44 |
|
id) echo "${ID}" ;; |
45 |
|
version) echo "${Version}" ;; |
46 |
|
version_id) echo "${Version_ID}" ;; |
47 |
|
pretty_name) echo "${PRETTY_NAME}" ;; |
48 |
|
ansi_color) echo "${ANSI_COLOR}" ;; |
49 |
|
cpe_name) echo "${CPE_NAME}" ;; |
50 |
|
esac |
51 |
|
fi |
52 |
|
} |
53 |
|
|
54 |
PATH=/sbin:/bin:$PATH |
PATH=/sbin:/bin:$PATH |
55 |
|
|
56 |
lilo=/sbin/lilo |
lilo=/sbin/lilo |
68 |
[ -f /etc/conf.d/grubby ] && . /etc/conf.d/grubby |
[ -f /etc/conf.d/grubby ] && . /etc/conf.d/grubby |
69 |
[ -f /etc/conf.d/grubby-uboot ] && . /etc/conf.d/grubby-uboot |
[ -f /etc/conf.d/grubby-uboot ] && . /etc/conf.d/grubby-uboot |
70 |
|
|
71 |
|
cfgGrub2="" |
72 |
|
cfgGrub2Efi="" |
73 |
cfgGrub="" |
cfgGrub="" |
74 |
cfgLilo="" |
cfgLilo="" |
75 |
|
cfgExtlinux="" |
76 |
cfguBoot="" |
cfguBoot="" |
77 |
runLilo="" |
runLilo="" |
78 |
grubConfig="" |
grubConfig="" |
79 |
|
grub2Config="" |
80 |
|
grub2EfiConfig="" |
81 |
|
extlinuxConfig="" |
82 |
|
|
83 |
ARCH=$(uname -m) |
ARCH=$(uname -m) |
84 |
|
|
91 |
elif [[ ${ARCH} = ppc64 ]] || [[ ${ARCH} = ppc ]] |
elif [[ ${ARCH} = ppc64 ]] || [[ ${ARCH} = ppc ]] |
92 |
then |
then |
93 |
liloConfig=/etc/yaboot.conf |
liloConfig=/etc/yaboot.conf |
94 |
|
grub2Config=/boot/grub/grub.cfg |
95 |
bootPrefix=/boot |
bootPrefix=/boot |
96 |
lilo=/sbin/ybin |
lilo=/sbin/ybin |
97 |
liloFlag=yaboot |
liloFlag=yaboot |
112 |
lilo=/sbin/zipl |
lilo=/sbin/zipl |
113 |
runLilo="yes" |
runLilo="yes" |
114 |
isx86="" |
isx86="" |
115 |
elif [[ ${ARCH} = armv7l ]] |
elif [[ ${ARCH} =~ armv[5|7].*l ]] |
116 |
then |
then |
117 |
liloConfig="" |
liloConfig="" |
118 |
bootPrefix=/boot |
bootPrefix=/boot |
119 |
ubootDir=${UBOOT_DIR:-"/boot/uboot"} |
ubootDir=${UBOOT_DIR:-"/boot"} |
120 |
ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"} |
ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"} |
121 |
ubootKList=${UBOOT_KLIST:-"klist.txt"} |
ubootKList=${UBOOT_KLIST:-"klist.txt"} |
122 |
ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"} |
ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"} |
123 |
ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"} |
ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"} |
124 |
ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"} |
ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"} |
125 |
|
ubootAddress=${UBOOT_IMGADDR:-"0x00008000"} |
126 |
mounted="" |
mounted="" |
127 |
liloFlag="" |
liloFlag="" |
128 |
isx86="" |
isx86="" |
130 |
# this leaves i?86 and x86_64 |
# this leaves i?86 and x86_64 |
131 |
liloConfig=/etc/lilo.conf |
liloConfig=/etc/lilo.conf |
132 |
grubConfig=/boot/grub/grub.conf |
grubConfig=/boot/grub/grub.conf |
133 |
|
grub2Config=/boot/grub/grub.cfg |
134 |
|
grub2EfiConfig=/boot/grub/grub-efi.cfg |
135 |
|
extlinuxConfig=/boot/extlinux/extlinux.conf |
136 |
bootPrefix=/boot |
bootPrefix=/boot |
137 |
liloFlag=lilo |
liloFlag=lilo |
138 |
isx86="yes" |
isx86="yes" |
148 |
verbose="" |
verbose="" |
149 |
makedefault="" |
makedefault="" |
150 |
package="" |
package="" |
151 |
mbkernel="" |
mbkernel="${HYPERVISOR}" |
152 |
mbargs="" |
mbargs="${HYPERVISOR_ARGS}" |
153 |
adddracutargs="" |
adddracutargs="" |
154 |
addplymouthinitrd="" |
addplymouthinitrd="" |
155 |
|
|
167 |
exit 1 |
exit 1 |
168 |
} |
} |
169 |
|
|
|
run_grub2() |
|
|
{ |
|
|
if [ -d /boot/grub -a -x /sbin/grub-mkconfig ] |
|
|
then |
|
|
cp /boot/grub/grub.cfg /boot/grub/grub.cfg.old |
|
|
/sbin/grub-mkconfig -o /boot/grub/grub.cfg |
|
|
fi |
|
|
} |
|
|
|
|
170 |
install() |
install() |
171 |
{ |
{ |
172 |
# XXX kernel should be able to be specified also (or work right on ia64) |
# XXX kernel should be able to be specified also (or work right on ia64) |
204 |
return |
return |
205 |
fi |
fi |
206 |
|
|
|
# Run grub2's configuration update in parallel, if it is installed |
|
|
run_grub2 |
|
|
|
|
207 |
# get the root filesystem to use |
# get the root filesystem to use |
208 |
rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab) |
rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab 2>/dev/null) |
209 |
|
if [[ -z $rootdevice ]] |
210 |
|
then |
211 |
|
rootdevice=$(grep -o -P "(?<=root=)\S+" /proc/cmdline) |
212 |
|
fi |
213 |
|
|
214 |
if [[ -n ${mbkernel} ]] && [[ -n ${cfgLilo} ]] && [[ ${liloFlag} != elilo ]] |
if [[ -n ${mbkernel} ]] && [[ -n ${cfgLilo} ]] && [[ ${liloFlag} != elilo ]] |
215 |
then |
then |
223 |
|
|
224 |
if [[ -n ${banner} ]] |
if [[ -n ${banner} ]] |
225 |
then |
then |
226 |
title="${banner} (${version})" |
title="${banner} [ ${version} ]" |
227 |
elif [ -f /etc/mageversion ] |
elif [ -f /etc/mageversion ] |
228 |
then |
then |
229 |
title="Magellan Linux $(< /etc/mageversion) (${version})" |
title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" |
230 |
|
elif [[ $(read_os_release id) = magellan ]] |
231 |
|
then |
232 |
|
title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]" |
233 |
else |
else |
234 |
title="Magellan Linux (${version})" |
title="Magellan Linux [ ${version} ]" |
235 |
fi |
fi |
236 |
${grubby} --add-kernel=${bootPrefix}/${kernelName}-${version} \ |
${grubby} --grub -c ${grubConfig} \ |
237 |
|
--add-kernel=${bootPrefix}/${kernelName}-${version} \ |
238 |
${INITRD} --copy-default ${makedefault} --title "${title}" \ |
${INITRD} --copy-default ${makedefault} --title "${title}" \ |
239 |
${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \ |
${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \ |
240 |
--args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}" |
--args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}" |
241 |
else |
else |
242 |
[[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby" |
[[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97" |
243 |
|
fi |
244 |
|
if [[ -n ${cfgGrub2} ]] |
245 |
|
then |
246 |
|
[[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}" |
247 |
|
|
248 |
|
if [[ -n ${banner} ]] |
249 |
|
then |
250 |
|
title="${banner} [ ${version} ]" |
251 |
|
elif [ -f /etc/mageversion ] |
252 |
|
then |
253 |
|
title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" |
254 |
|
elif [[ $(read_os_release id) = magellan ]] |
255 |
|
then |
256 |
|
title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]" |
257 |
|
else |
258 |
|
title="Magellan Linux [ ${version} ]" |
259 |
|
fi |
260 |
|
${grubby} --grub2 -c ${grub2Config} \ |
261 |
|
--add-kernel=${bootPrefix}/${kernelName}-${version} \ |
262 |
|
${INITRD} --copy-default ${makedefault} --title "${title}" \ |
263 |
|
${mbkernel:+--add-multiboot="${mbkernel}"} \ |
264 |
|
${mbargs:+--mbargs="${mbargs}"} \ |
265 |
|
--args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}" |
266 |
|
else |
267 |
|
[[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2" |
268 |
|
fi |
269 |
|
if [[ -n ${cfgGrub2Efi} ]] |
270 |
|
then |
271 |
|
[[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}" |
272 |
|
|
273 |
|
if [[ -n ${banner} ]] |
274 |
|
then |
275 |
|
title="${banner} [ ${version} ]" |
276 |
|
elif [ -f /etc/mageversion ] |
277 |
|
then |
278 |
|
title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" |
279 |
|
elif [[ $(read_os_release id) = magellan ]] |
280 |
|
then |
281 |
|
title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]" |
282 |
|
else |
283 |
|
title="Magellan Linux [ ${version} ]" |
284 |
|
fi |
285 |
|
${grubby} --grub2 -c ${grub2EfiConfig} --efi \ |
286 |
|
--add-kernel=${bootPrefix}/${kernelName}-${version} \ |
287 |
|
${INITRD} --copy-default ${makedefault} --title "${title}" \ |
288 |
|
${mbkernel:+--add-multiboot="${mbkernel}"} \ |
289 |
|
${mbargs:+--mbargs="${mbargs}"} \ |
290 |
|
--args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}" |
291 |
|
else |
292 |
|
[[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby for grub 2 with UEFI" |
293 |
fi |
fi |
294 |
|
|
295 |
if [[ -n ${cfgLilo} ]] |
if [[ -n ${cfgLilo} ]] |
315 |
else |
else |
316 |
[[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby" |
[[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby" |
317 |
fi |
fi |
318 |
|
|
319 |
|
if [[ -n ${cfgExtlinux} ]] |
320 |
|
then |
321 |
|
[[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}" |
322 |
|
|
323 |
|
if [[ -n ${banner} ]] |
324 |
|
then |
325 |
|
title="${banner} [ ${version} ]" |
326 |
|
elif [ -f /etc/mageversion ] |
327 |
|
then |
328 |
|
title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" |
329 |
|
elif [[ $(read_os_release id) = magellan ]] |
330 |
|
then |
331 |
|
title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]" |
332 |
|
else |
333 |
|
title="Magellan Linux [ ${version} ]" |
334 |
|
fi |
335 |
|
${grubby} --extlinux -c ${extlinuxConfig} \ |
336 |
|
--add-kernel=${bootPrefix}/${kernelName}-${version} \ |
337 |
|
${INITRD} --copy-default ${makedefault} --title "${title}" \ |
338 |
|
${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \ |
339 |
|
--args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}" |
340 |
|
else |
341 |
|
[[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux" |
342 |
|
fi |
343 |
} |
} |
344 |
|
|
345 |
remove() |
remove() |
352 |
return |
return |
353 |
fi |
fi |
354 |
|
|
|
# Run grub2's configuration update in parallel, if it is installed |
|
|
run_grub2 |
|
|
|
|
355 |
if [[ -n ${cfgGrub} ]] |
if [[ -n ${cfgGrub} ]] |
356 |
then |
then |
357 |
[[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}" |
[[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}" |
358 |
${grubby} --remove-kernel=${bootPrefix}/${kernelName}-${version} |
${grubby} --grub -c ${grubConfig} \ |
359 |
|
--remove-kernel=${bootPrefix}/${kernelName}-${version} |
360 |
else |
else |
361 |
[[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby" |
[[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97" |
362 |
|
fi |
363 |
|
if [[ -n ${cfgGrub2} ]] |
364 |
|
then |
365 |
|
[[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}" |
366 |
|
${grubby} --grub2 -c ${grub2Config} \ |
367 |
|
--remove-kernel=${bootPrefix}/${kernelName}-${version} |
368 |
|
else |
369 |
|
[[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2" |
370 |
|
fi |
371 |
|
if [[ -n ${cfgGrub2Efi} ]] |
372 |
|
then |
373 |
|
[[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}" |
374 |
|
${grubby} --grub2 -c ${grub2EfiConfig} --efi \ |
375 |
|
--remove-kernel=${bootPrefix}/${kernelName}-${version} |
376 |
|
else |
377 |
|
[[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby grub 2 with UEFI" |
378 |
fi |
fi |
379 |
|
|
380 |
if [[ -n ${cfgLilo} ]] |
if [[ -n ${cfgLilo} ]] |
404 |
then |
then |
405 |
tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX) |
tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX) |
406 |
curversion=$(tail -n1 ${ubootDir}/${ubootKList}) |
curversion=$(tail -n1 ${ubootDir}/${ubootKList}) |
407 |
sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList} |
sed "/$version$/d" ${ubootDir}/${ubootKList} > ${tmpKList} |
408 |
newversion=$(tail -n1 ${tmpKList}) |
newversion=$(tail -n1 ${tmpKList}) |
409 |
if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ] |
if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ] |
410 |
then |
then |
444 |
[ -f ${tmpKList} ] && rm -f ${tmpKList} |
[ -f ${tmpKList} ] && rm -f ${tmpKList} |
445 |
fi |
fi |
446 |
else |
else |
447 |
[[ -n ${verbose} ]] && echo "No previous kernel version. uBoot images not removed!" |
[[ -n ${verbose} ]] && echo "No previous kernel version. U-Boot images not removed!" |
448 |
fi |
fi |
449 |
else |
else |
450 |
[[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not modifying ${ubootDir}" |
[[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not modifying ${ubootDir}" |
451 |
fi |
fi |
452 |
|
|
453 |
|
if [[ -n ${cfgExtlinux} ]] |
454 |
|
then |
455 |
|
[[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}" |
456 |
|
${grubby} --extlinux -c ${extlinuxConfig} \ |
457 |
|
--remove-kernel=${bootPrefix}/${kernelName}-${version} |
458 |
|
else |
459 |
|
[[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux" |
460 |
|
fi |
461 |
} |
} |
462 |
|
|
463 |
update() |
update() |
480 |
fi |
fi |
481 |
fi |
fi |
482 |
|
|
|
# Run grub2's configuration update in parallel, if it is installed |
|
|
run_grub2 |
|
|
|
|
483 |
if [[ -n ${cfgGrub} ]] |
if [[ -n ${cfgGrub} ]] |
484 |
then |
then |
485 |
[[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}" |
[[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}" |
486 |
${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \ |
${grubby} --grub -c ${grubConfig} \ |
487 |
|
--update-kernel=${bootPrefix}/${kernelName}-${version} \ |
488 |
${INITRD} \ |
${INITRD} \ |
489 |
${kernargs:+--args="${kernargs}"} \ |
${kernargs:+--args="${kernargs}"} \ |
490 |
${removeargs:+--remove-args="${removeargs}"} |
${removeargs:+--remove-args="${removeargs}"} |
492 |
[[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby" |
[[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby" |
493 |
fi |
fi |
494 |
|
|
495 |
|
if [[ -n ${cfgGrub2} ]] |
496 |
|
then |
497 |
|
[[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}" |
498 |
|
${grubby} --grub2 -c ${grub2Config} \ |
499 |
|
--update-kernel=${bootPrefix}/${kernelName}-${version} \ |
500 |
|
${INITRD} \ |
501 |
|
${kernargs:+--args="${kernargs}"} \ |
502 |
|
${removeargs:+--remove-args="${removeargs}"} |
503 |
|
else |
504 |
|
[[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby" |
505 |
|
fi |
506 |
|
|
507 |
|
if [[ -n ${cfgGrub2Efi} ]] |
508 |
|
then |
509 |
|
[[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}" |
510 |
|
${grubby} --grub2 -c ${grub2EfiConfig} --efi \ |
511 |
|
--update-kernel=${bootPrefix}/${kernelName}-${version} \ |
512 |
|
${INITRD} \ |
513 |
|
${kernargs:+--args="${kernargs}"} \ |
514 |
|
${removeargs:+--remove-args="${removeargs}"} |
515 |
|
else |
516 |
|
[[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby" |
517 |
|
fi |
518 |
|
|
519 |
if [[ -n ${cfgLilo} ]] |
if [[ -n ${cfgLilo} ]] |
520 |
then |
then |
521 |
[[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}" |
[[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}" |
544 |
[[ -n ${verbose} ]] && echo "adding $version to ${ubootDir}..." |
[[ -n ${verbose} ]] && echo "adding $version to ${ubootDir}..." |
545 |
|
|
546 |
[[ -n ${verbose} ]] && echo "creating uImage-${version}" |
[[ -n ${verbose} ]] && echo "creating uImage-${version}" |
547 |
mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 \ |
mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \ |
548 |
-n ${version} -d ${bootPrefix}/${kernelName}-${version} ${ubootDir}/uImage-${version} |
-e ${ubootAddress} -n ${version} \ |
549 |
|
-d ${bootPrefix}/${kernelName}-${version} ${ubootDir}/uImage-${version} |
550 |
|
|
551 |
[[ -n ${verbose} ]] && echo "creating uInitrd-${version}" |
[[ -n ${verbose} ]] && echo "creating uInitrd-${version}" |
552 |
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 \ |
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 \ |
571 |
else |
else |
572 |
[[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not setting up ${ubootDir}" |
[[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not setting up ${ubootDir}" |
573 |
fi |
fi |
574 |
|
|
575 |
|
if [[ -n ${cfgExtlinux} ]] |
576 |
|
then |
577 |
|
[[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}" |
578 |
|
${grubby} --extlinux -c ${extlinuxConfig} \ |
579 |
|
--update-kernel=${bootPrefix}/${kernelName}-${version} \ |
580 |
|
${INITRD} \ |
581 |
|
${kernargs:+--args="${kernargs}"} \ |
582 |
|
${removeargs:+--remove-args="${removeargs}"} |
583 |
|
else |
584 |
|
[[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby" |
585 |
|
fi |
586 |
} |
} |
587 |
|
|
588 |
mkinitrd() |
makeinitrd() |
589 |
{ |
{ |
590 |
if [[ -n ${dracut} ]] |
if [[ -n ${dracut} ]] |
591 |
then |
then |
592 |
tool="/sbin/dracut ${dracuthostonly} -f ${initrdfile} ${version}" |
tool="dracut ${dracuthostonly} -f ${initrdfile} ${version}" |
593 |
else |
else |
594 |
tool="/sbin/mkinitrd --allow-missing -f ${initrdfile} ${version}" |
tool="mkinitrd --allow-missing -f ${initrdfile} ${version}" |
595 |
fi |
fi |
596 |
[[ -n ${verbose} ]] && echo "creating initrd ${initrdfile} using ${version}" |
[[ -n ${verbose} ]] && echo "creating initrd ${initrdfile} using ${version}" |
597 |
${tool} |
${tool} |
800 |
# add dracut i18n, keyboard and plymouth kernel args if requested |
# add dracut i18n, keyboard and plymouth kernel args if requested |
801 |
if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]] |
if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]] |
802 |
then |
then |
803 |
[ -r /etc/conf.d/keymap ] && . /etc/conf.d/keymap |
if [ -r /etc/vconsole.conf ] |
|
[ -r /etc/conf.d/consolefont ] && . /etc/conf.d/consolefont |
|
|
|
|
|
if [[ -n ${KEYMAP} ]] |
|
804 |
then |
then |
805 |
kernargs="${kernargs} KEYTABLE=${KEYMAP}" |
. /etc/vconsole.conf |
806 |
|
|
807 |
|
for i in SYSFONT SYSFONTACM UNIMAP KEYTABLE |
808 |
|
do |
809 |
|
val=$(eval echo \$$i) |
810 |
|
[[ -n ${val} ]] && kernargs="${kernargs} ${i}=${val}" |
811 |
|
done |
812 |
|
else |
813 |
|
if [ -r /etc/conf.d/consolefont ] |
814 |
|
then |
815 |
|
. /etc/conf.d/consolefont |
816 |
|
|
817 |
|
if [[ -n ${CONSOLEFONT} ]] |
818 |
|
then |
819 |
|
kernargs="${kernargs} SYSFONT=${CONSOLEFONT}" |
820 |
|
fi |
821 |
|
fi |
822 |
|
|
823 |
|
if [ -r /etc/conf.d/keymap ] |
824 |
|
then |
825 |
|
. /etc/conf.d/keymap |
826 |
|
|
827 |
|
if [[ -n ${KEYMAP} ]] |
828 |
|
then |
829 |
|
kernargs="${kernargs} KEYTABLE=${KEYMAP}" |
830 |
|
fi |
831 |
|
fi |
832 |
fi |
fi |
833 |
|
|
834 |
if [[ -n ${CONSOLEFONT} ]] |
if [ -r /etc/locale.conf ] |
835 |
then |
then |
836 |
kernargs="${kernargs} SYSFONT=${CONSOLEFONT}" |
. /etc/locale.conf |
837 |
|
|
838 |
|
if [[ -n ${LANG} ]] |
839 |
|
then |
840 |
|
kernargs="${kernargs} LANG=${LANG}" |
841 |
|
fi |
842 |
fi |
fi |
843 |
fi |
fi |
844 |
|
|
860 |
|
|
861 |
if [[ ${initrd} = make ]] |
if [[ ${initrd} = make ]] |
862 |
then |
then |
863 |
mkinitrd |
makeinitrd |
864 |
elif [[ ${initrd} = remove ]] |
elif [[ ${initrd} = remove ]] |
865 |
then |
then |
866 |
rminitrd |
rminitrd |
873 |
fi |
fi |
874 |
|
|
875 |
[[ -n ${grubConfig} ]] && [ -f ${grubConfig} ] && cfgGrub=1 |
[[ -n ${grubConfig} ]] && [ -f ${grubConfig} ] && cfgGrub=1 |
876 |
|
[[ -n ${grub2Config} ]] && [ -f ${grub2Config} ] && cfgGrub2=1 |
877 |
|
[[ -n ${grub2EfiConfig} ]] && [ -f ${grub2EfiConfig} ] && cfgGrub2Efi=1 |
878 |
[[ -n ${liloConfig} ]] && [ -f ${liloConfig} ] && cfgLilo=1 |
[[ -n ${liloConfig} ]] && [ -f ${liloConfig} ] && cfgLilo=1 |
879 |
|
[[ -n ${extlinuxConfig} ]] && [ -f ${extlinuxConfig} ] && cfgExtlinux=1 |
880 |
|
|
881 |
# if we have a uBoot directory, check if it is mounted. |
# if we have a U-Boot directory, but no boot script, check if the directory |
882 |
# if not, mount it. Then check if a boot script exists. |
# is mounted. If not, mount it, and then check if a boot script exists. |
883 |
if [[ -n ${ubootDir} ]] |
if [[ -n ${ubootDir} ]] |
884 |
then |
then |
885 |
mountEntry=$(mount | grep ${ubootDir}) |
if [ -f ${ubootScript} ] |
886 |
if [[ -z ${mountEntry} ]] |
then |
887 |
|
cfguBoot=1 |
888 |
|
else |
889 |
|
mountEntry=$(mount | grep ${ubootDir}) |
890 |
|
if [[ -z ${mountEntry} ]] |
891 |
|
then |
892 |
|
mount ${ubootDevice} ${ubootDir} |
893 |
|
mounted=1 |
894 |
|
fi |
895 |
|
[ -f ${ubootScript} ] && cfguBoot=1 |
896 |
|
fi |
897 |
|
fi |
898 |
|
|
899 |
|
# if we're using U-Boot, check if the default load address should change |
900 |
|
if [[ -n ${cfguBoot} ]] && [[ -z ${UBOOT_IMGADDR} ]] |
901 |
|
then |
902 |
|
[[ ${version} =~ .([^.]*)$ ]] |
903 |
|
platform=${BASH_REMATCH[1]} |
904 |
|
# A few platforms use an alternate kernel load address |
905 |
|
if [[ ${platform} = omap ]] |
906 |
|
then |
907 |
|
ubootAddress=0x80008000 |
908 |
|
elif [[ ${platform} = imx ]] |
909 |
then |
then |
910 |
mount ${ubootDevice} ${ubootDir} |
ubootAddress=0x90008000 |
|
mounted=1 |
|
911 |
fi |
fi |
|
[ -f ${ubootScript} ] && cfguBoot=1 |
|
912 |
fi |
fi |
913 |
|
|
914 |
# if we have a lilo config on an x86 box, see if the default boot loader |
# if we have a lilo config on an x86 box, see if the default boot loader |
929 |
update |
update |
930 |
fi |
fi |
931 |
|
|
932 |
|
# if we mounted the U-Boot directory, unmount it. |
933 |
|
[[ -n ${mounted} ]] && umount ${ubootDir} |
934 |
|
|
935 |
exit 0 |
exit 0 |