Magellan Linux

Diff of /tags/grubby-8_40_20170706/new-kernel-pkg

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1332 by niro, Fri Jun 3 20:32:19 2011 UTC revision 1803 by niro, Mon Apr 16 17:51:27 2012 UTC
# Line 25  Line 25 
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
# Line 40  else Line 66  else
66  fi  fi
67    
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
70    
71    cfgGrub2=""
72    cfgGrub2Efi=""
73  cfgGrub=""  cfgGrub=""
74  cfgLilo=""  cfgLilo=""
75    cfgExtlinux=""
76    cfguBoot=""
77  runLilo=""  runLilo=""
78  grubConfig=""  grubConfig=""
79    grub2Config=""
80    grub2EfiConfig=""
81    extlinuxConfig=""
82    
83  ARCH=$(uname -m)  ARCH=$(uname -m)
84    
# Line 57  then Line 91  then
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
# Line 77  then Line 112  then
112   lilo=/sbin/zipl   lilo=/sbin/zipl
113   runLilo="yes"   runLilo="yes"
114   isx86=""   isx86=""
115    elif [[ ${ARCH} = armv7l ]] || [[ ${ARCH} = armv7hl ]] || [[ ${ARCH} = armv5tel ]]
116    then
117     machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')
118     liloConfig=""
119     bootPrefix=/boot
120     ubootDir=${UBOOT_DIR:-"/boot/uboot"}
121     ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"}
122     ubootKList=${UBOOT_KLIST:-"klist.txt"}
123     ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"}
124     ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"}
125     ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"}
126     mounted=""
127     liloFlag=""
128     isx86=""
129     if [[ ${machine} == "OMAP3 Beagle Board" ]] || [[ ${machine} == "OMAP4 Panda board" ]]
130     then
131     ubootAddress=0x80008000
132     else
133     ubootAddress=0x00008000
134     fi
135  else  else
136   # this leaves i?86 and x86_64   # this leaves i?86 and x86_64
137   liloConfig=/etc/lilo.conf   liloConfig=/etc/lilo.conf
138   grubConfig=/boot/grub/grub.conf   grubConfig=/boot/grub/grub.conf
139     grub2Config=/boot/grub/grub.cfg
140     grub2EfiConfig=/boot/grub/grub-efi.cfg
141     extlinuxConfig=/boot/extlinux/extlinux.conf
142   bootPrefix=/boot   bootPrefix=/boot
143   liloFlag=lilo   liloFlag=lilo
144   isx86="yes"   isx86="yes"
# Line 89  fi Line 147  fi
147  mode=""  mode=""
148  version=""  version=""
149  initrd=""  initrd=""
150    dracut=""
151    dracuthostonly=""
152  initrdfile=""  initrdfile=""
153  moddep=""  moddep=""
154  verbose=""  verbose=""
155  makedefault=""  makedefault=""
156  package=""  package=""
157  mbkernel=""  mbkernel="${HYPERVISOR}"
158  mbargs=""  mbargs="${HYPERVISOR_ARGS}"
159    adddracutargs=""
160    addplymouthinitrd=""
161    
162  usage()  usage()
163  {  {
164   echo "Usage: $(basename $0) [-v] [--mkinitrd] [--rminitrd]" >&2   echo "Usage: $(basename $0) [-v] [--mkinitrd] [--rminitrd] [--dracut]" >&2
165   echo "       [--initrdfile=<initrd-image>] [--depmod] [--rmmoddep]" >&2   echo "       [--initrdfile=<initrd-image>] [--depmod] [--rmmoddep]" >&2
166   echo "       [--kernel-args=<args>] [--remove-args=<args>]" >&2   echo "       [--kernel-args=<args>] [--remove-args=<args>]" >&2
167   echo "       [--banner=<banner>] [--multiboot=multiboot]" >&2   echo "       [--banner=<banner>] [--multiboot=multiboot]" >&2
168   echo "       [--mbargs=mbargs] [--make-default]" >&2   echo "       [--mbargs=mbargs] [--make-default] [--add-dracut-args]" >&2
169     echo "       [--add-plymouth-initrd]" >&2
170     echo "       [--host-only]" >&2
171   echo "       <--install | --remove | --update> <kernel-version>" >&2   echo "       <--install | --remove | --update> <kernel-version>" >&2
172   echo "       (ex: $(basename $0) --mkinitrd --depmod --install 2.4.7-2)" >&2   echo "       (ex: $(basename $0) --mkinitrd --depmod --install 2.4.7-2)" >&2
173   exit 1   exit 1
174  }  }
175    
 run_grub2()  
 {  
  if [ -d /boot/grub2 -a -x /sbin/grub2-mkconfig ]  
  then  
  cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.old  
  /sbin/grub2-mkconfig -o /boot/grub2/grub.cfg  
  fi  
 }  
   
176  install()  install()
177  {  {
178   # 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)
# Line 132  install() Line 187  install()
187   then   then
188   [[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby"   [[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby"
189   INITRD="--initrd ${initrdfile}"   INITRD="--initrd ${initrdfile}"
190    
191     if [[ -n ${addplymouthinitrd} ]]
192     then
193     INITRD="${INITRD} --extra-initrd ${bootPrefix}/initrd-plymouth.img"
194     fi
195   fi   fi
196    
197   # 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?
# Line 150  install() Line 210  install()
210   return   return
211   fi   fi
212    
  # Run grub2's configuration update in parallel, if it is installed  
  run_grub2  
   
213   # get the root filesystem to use   # get the root filesystem to use
214   rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab)   rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab)
215    
# Line 168  install() Line 225  install()
225    
226   if [[ -n ${banner} ]]   if [[ -n ${banner} ]]
227   then   then
228   title="${banner} (${version})"   title="${banner} [ ${version} ]"
229   elif [ -f /etc/mageversion ]   elif [ -f /etc/mageversion ]
230   then   then
231   title="Magellan Linux $(< /etc/mageversion) (${version})"   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
232     elif [[ $(read_os_release id) = magellan ]]
233     then
234     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
235   else   else
236   title="Magellan Linux (${version})"   title="Magellan Linux [ ${version} ]"
237   fi   fi
238   ${grubby} --add-kernel=${bootPrefix}/${kernelName}-${version} \   ${grubby} --grub -c ${grubConfig} \
239     --add-kernel=${bootPrefix}/${kernelName}-${version} \
240   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
241   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
242   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
243   else   else
244   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97"
245     fi
246     if [[ -n ${cfgGrub2} ]]
247     then
248     [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}"
249    
250     if [[ -n ${banner} ]]
251     then
252     title="${banner} [ ${version} ]"
253     elif [ -f /etc/mageversion ]
254     then
255     title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
256     elif [[ $(read_os_release id) = magellan ]]
257     then
258     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
259     else
260     title="Magellan Linux [ ${version} ]"
261     fi
262     ${grubby} --grub2 -c ${grub2Config} \
263     --add-kernel=${bootPrefix}/${kernelName}-${version} \
264     ${INITRD} --copy-default ${makedefault} --title "${title}" \
265     ${mbkernel:+--add-multiboot="${mbkernel}"} \
266     ${mbargs:+--mbargs="${mbargs}"} \
267     --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
268     else
269     [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2"
270     fi
271     if [[ -n ${cfgGrub2Efi} ]]
272     then
273     [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"
274    
275     if [[ -n ${banner} ]]
276     then
277     title="${banner} [ ${version} ]"
278     elif [ -f /etc/mageversion ]
279     then
280     title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
281     elif [[ $(read_os_release id) = magellan ]]
282     then
283     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
284     else
285     title="Magellan Linux [ ${version} ]"
286     fi
287     ${grubby} --grub2 -c ${grub2EfiConfig} \
288     --add-kernel=${bootPrefix}/${kernelName}-${version} \
289     ${INITRD} --copy-default ${makedefault} --title "${title}" \
290     ${mbkernel:+--add-multiboot="${mbkernel}"} \
291     ${mbargs:+--mbargs="${mbargs}"} \
292     --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
293     else
294     [[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby for grub 2 with UEFI"
295   fi   fi
296    
297   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
# Line 206  install() Line 317  install()
317   else   else
318   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"
319   fi   fi
320    
321     if [[ -n ${cfgExtlinux} ]]
322     then
323     [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"
324    
325     if [[ -n ${banner} ]]
326     then
327     title="${banner} [ ${version} ]"
328     elif [ -f /etc/mageversion ]
329     then
330     title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
331     elif [[ $(read_os_release id) = magellan ]]
332     then
333     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
334     else
335     title="Magellan Linux [ ${version} ]"
336     fi
337     ${grubby} --extlinux -c ${extlinuxConfig} \
338     --add-kernel=${bootPrefix}/${kernelName}-${version} \
339     ${INITRD} --copy-default ${makedefault} --title "${title}" \
340     ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
341     --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
342     else
343     [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"
344     fi
345  }  }
346    
347  remove()  remove()
# Line 218  remove() Line 354  remove()
354   return   return
355   fi   fi
356    
  # Run grub2's configuration update in parallel, if it is installed  
  run_grub2  
   
357   if [[ -n ${cfgGrub} ]]   if [[ -n ${cfgGrub} ]]
358   then   then
359   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"
360   ${grubby} --remove-kernel=${bootPrefix}/${kernelName}-${version}   ${grubby} --grub -c ${grubConfig} \
361     --remove-kernel=${bootPrefix}/${kernelName}-${version}
362   else   else
363   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97"
364     fi
365     if [[ -n ${cfgGrub2} ]]
366     then
367     [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"
368     ${grubby} --grub2 -c ${grub2Config} \
369     --remove-kernel=${bootPrefix}/${kernelName}-${version}
370     else
371     [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2"
372     fi
373     if [[ -n ${cfgGrub2Efi} ]]
374     then
375     [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"
376     ${grubby} --grub2 -c ${grub2EfiConfig} \
377     --remove-kernel=${bootPrefix}/${kernelName}-${version}
378     else
379     [[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby grub 2 with UEFI"
380   fi   fi
381    
382   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
# Line 247  remove() Line 397  remove()
397   else   else
398   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"
399   fi   fi
400    
401     if [[ -n ${cfguBoot} ]]
402     then
403     [[ -n ${verbose} ]] && echo "removing ${version} from ${ubootDir}..."
404    
405     if [ -f ${ubootDir}/${ubootKList} ]
406     then
407     tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)
408     curversion=$(tail -n1 ${ubootDir}/${ubootKList})
409     sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList}
410     newversion=$(tail -n1 ${tmpKList})
411     if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]
412     then
413     if [[ ${curversion} != ${newversion} ]]
414     then
415     cp -fp ${ubootDir}/uImage-${newversion} ${ubootDir}/${ubootDefaultImage}
416     if [ $? -ne 0 ]
417     then
418     [[ -n ${verbose} ]] && echo "copy uImage-${newversion} error, default kernel not replaced!" && exit
419     fi
420     cp -fp ${ubootDir}/uInitrd-${newversion} ${ubootDir}/${ubootDefaultInitrd}
421     if [ $? -ne 0 ]
422     then
423     [[ -n ${verbose} ]] && echo "copy uInitrd-${newversion} error, default Initrd not replaced!" && exit
424     fi
425     fi
426    
427     [[ -n ${verbose} ]] && echo "removing uImage-${version}"
428     if [ -f ${ubootDir}/uImage-${version} ]
429     then
430     rm -f ${ubootDir}/uImage-${version}
431     else
432     [[ -n ${verbose} ]] && echo "uImage-${version} did not exist!"
433     fi
434    
435     [[ -n ${verbose} ]] && echo "removing uInitrd-${version}"
436     if [ -f ${ubootDir}/uInitrd-${version} ]
437     then
438     rm -f ${ubootDir}/uInitrd-${version}
439     else
440     [[ -n ${verbose} ]] && echo "uInitrd-${version} did not exist!"
441     fi
442    
443     mv ${tmpKList} ${ubootDir}/${ubootKList}
444     else
445     [[ -n ${verbose} ]] && echo "uImage ${newversion} does not exist!"
446     [ -f ${tmpKList} ] && rm -f ${tmpKList}
447     fi
448     else
449     [[ -n ${verbose} ]] && echo "No previous kernel version.  U-Boot images not removed!"
450     fi
451     else
452     [[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not modifying ${ubootDir}"
453     fi
454    
455     if [[ -n ${cfgExtlinux} ]]
456     then
457     [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"
458     ${grubby} --extlinux -c ${extlinuxConfig} \
459     --remove-kernel=${bootPrefix}/${kernelName}-${version}
460     else
461     [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"
462     fi
463  }  }
464    
465  update()  update()
# Line 262  update() Line 475  update()
475   then   then
476   [[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby"   [[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby"
477   INITRD="--initrd ${initrdfile}"   INITRD="--initrd ${initrdfile}"
  fi  
478    
479   # Run grub2's configuration update in parallel, if it is installed   if [[ -n ${addplymouthinitrd} ]]
480   run_grub2   then
481     INITRD="${INITRD} --extra-initrd ${bootPrefix}/initrd-plymouth.img"
482     fi
483     fi
484    
485   if [[ -n ${cfgGrub} ]]   if [[ -n ${cfgGrub} ]]
486   then   then
487   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"
488   ${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \   ${grubby} --grub -c ${grubConfig} \
489     --update-kernel=${bootPrefix}/${kernelName}-${version} \
490   ${INITRD} \   ${INITRD} \
491   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
492   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 278  update() Line 494  update()
494   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"
495   fi   fi
496    
497     if [[ -n ${cfgGrub2} ]]
498     then
499     [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"
500     ${grubby} --grub2 -c ${grub2Config} \
501     --update-kernel=${bootPrefix}/${kernelName}-${version} \
502     ${INITRD} \
503     ${kernargs:+--args="${kernargs}"} \
504     ${removeargs:+--remove-args="${removeargs}"}
505     else
506     [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby"
507     fi
508    
509     if [[ -n ${cfgGrub2Efi} ]]
510     then
511     [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"
512     ${grubby} --grub2 -c ${grub2EfiConfig} \
513     --update-kernel=${bootPrefix}/${kernelName}-${version} \
514     ${INITRD} \
515     ${kernargs:+--args="${kernargs}"} \
516     ${removeargs:+--remove-args="${removeargs}"}
517     else
518     [[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby"
519     fi
520    
521   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
522   then   then
523   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"
# Line 300  update() Line 540  update()
540   else   else
541   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"
542   fi   fi
543    
544     if [[ -n ${cfguBoot} ]]
545     then
546     [[ -n ${verbose} ]] && echo "adding $version to ${ubootDir}..."
547    
548     [[ -n ${verbose} ]] && echo "creating uImage-${version}"
549     mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \
550     -e ${ubootAddress} -n ${version} \
551     -d ${bootPrefix}/${kernelName}-${version} ${ubootDir}/uImage-${version}
552    
553     [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"
554     mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 \
555     -n initramfs -d ${initrdfile} ${ubootDir}/uInitrd-${version}
556    
557     if [ -f ${ubootDir}/uImage-${version} ] && [ -f ${ubootDir}/uInitrd-${version} ]
558     then
559     cp -fp ${ubootDir}/uImage-${version} ${ubootDir}/${ubootDefaultImage}
560     if [ $? -ne 0 ]
561     then
562     [[ -n ${verbose} ]] && echo "copy uImage-${version} error, kernel not installed!" && exit
563     fi
564     cp -fp ${ubootDir}/uInitrd-${version} ${ubootDir}/${ubootDefaultInitrd}
565     if [ $? -ne 0 ]
566     then
567     [[ -n ${verbose} ]] && echo "copy uInitrd-${version} error, kernel not installed!" && exit
568     fi
569     echo ${version} >> ${ubootDir}/${ubootKList}
570     else
571     [[ -n ${verbose} ]] && echo "cannot make ${version} the default"
572     fi
573     else
574     [[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not setting up ${ubootDir}"
575     fi
576    
577     if [[ -n ${cfgExtlinux} ]]
578     then
579     [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"
580     ${grubby} --extlinux -c ${extlinuxConfig} \
581     --update-kernel=${bootPrefix}/${kernelName}-${version} \
582     ${INITRD} \
583     ${kernargs:+--args="${kernargs}"} \
584     ${removeargs:+--remove-args="${removeargs}"}
585     else
586     [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby"
587     fi
588  }  }
589    
590  mkinitrd()  makeinitrd()
591  {  {
592     if [[ -n ${dracut} ]]
593     then
594     tool="dracut ${dracuthostonly} -f ${initrdfile} ${version}"
595     else
596     tool="mkinitrd --allow-missing -f ${initrdfile} ${version}"
597     fi
598   [[ -n ${verbose} ]] && echo "creating initrd ${initrdfile} using ${version}"   [[ -n ${verbose} ]] && echo "creating initrd ${initrdfile} using ${version}"
599   /sbin/mkinitrd --allow-missing -f ${initrdfile} ${version}   ${tool}
600   rc=$?   rc=$?
601   if [ ${rc} != 0 ]   if [ ${rc} != 0 ]
602   then   then
# Line 344  do Line 635  do
635   initrd="remove"   initrd="remove"
636   ;;   ;;
637    
638     --dracut)
639     dracut=--dracut
640     ;;
641    
642     --host-only)
643     dracuthostonly=-H
644     ;;
645    
646   --initrdfile*)   --initrdfile*)
647   if echo $1 | grep '=' >/dev/null   if echo $1 | grep '=' >/dev/null
648   then   then
# Line 427  do Line 726  do
726   fi   fi
727   ;;   ;;
728    
729     --add-dracut-args)
730     adddracutargs=--add-dracut-args
731     ;;
732    
733     --add-plymouth-initrd)
734     addplymouthinitrd=--add-plymouth-initrd
735     ;;
736    
737   -v)   -v)
738   verbose=-v   verbose=-v
739   ;;   ;;
# Line 478  fi Line 785  fi
785  if [[ -z ${initrdfile} ]]  if [[ -z ${initrdfile} ]]
786  then  then
787   INITRD_NAME_PREFIX="initrd"   INITRD_NAME_PREFIX="initrd"
788     if [[ -n ${dracut} ]]
789     then
790     INITRD_NAME_PREFIX="initramfs"
791     fi
792    
793   if [[ $(uname -m) = ia64 ]]   if [[ $(uname -m) = ia64 ]]
794   then   then
# Line 488  then Line 799  then
799  fi  fi
800  [[ -n ${verbose} ]] && echo "initrdfile is ${initrdfile}"  [[ -n ${verbose} ]] && echo "initrdfile is ${initrdfile}"
801    
802    # add dracut i18n, keyboard and plymouth kernel args if requested
803    if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]
804    then
805     [ -r /etc/conf.d/keymap ] && . /etc/conf.d/keymap
806     [ -r /etc/conf.d/consolefont ] && . /etc/conf.d/consolefont
807    
808     if [[ -n ${KEYMAP} ]]
809     then
810     kernargs="${kernargs} KEYTABLE=${KEYMAP}"
811     fi
812    
813     if [[ -n ${CONSOLEFONT} ]]
814     then
815     kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"
816     fi
817    fi
818    
819  # 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
820  if [[ ${mode} = --install ]] && [[ ${UPDATEDEFAULT} = yes ]] && [[ -n ${package} ]] &&  if [[ ${mode} = --install ]] && [[ ${UPDATEDEFAULT} = yes ]] && [[ -n ${package} ]] &&
821   [[ -n ${DEFAULTKERNEL} ]] && [[ ${package} = ${DEFAULTKERNEL} ]]   [[ -n ${DEFAULTKERNEL} ]] && [[ ${package} = ${DEFAULTKERNEL} ]]
# Line 506  fi Line 834  fi
834    
835  if [[ ${initrd} = make ]]  if [[ ${initrd} = make ]]
836  then  then
837   mkinitrd   makeinitrd
838  elif [[ ${initrd} = remove ]]  elif [[ ${initrd} = remove ]]
839  then  then
840   rminitrd   rminitrd
# Line 519  then Line 847  then
847  fi  fi
848    
849  [[ -n ${grubConfig} ]] && [ -f ${grubConfig} ] && cfgGrub=1  [[ -n ${grubConfig} ]] && [ -f ${grubConfig} ] && cfgGrub=1
850    [[ -n ${grub2Config} ]] && [ -f ${grub2Config} ] && cfgGrub2=1
851    [[ -n ${grub2EfiConfig} ]] && [ -f ${grub2EfiConfig} ] && cfgGrub2Efi=1
852  [[ -n ${liloConfig} ]] && [ -f ${liloConfig} ] && cfgLilo=1  [[ -n ${liloConfig} ]] && [ -f ${liloConfig} ] && cfgLilo=1
853    [[ -n ${extlinuxConfig} ]] && [ -f ${extlinuxConfig} ] && cfgExtlinux=1
854    
855    # if we have a U-Boot directory, but no boot script, check if the directory
856    # is mounted.  If not, mount it, and then check if a boot script exists.
857    if [[ -n ${ubootDir} ]]
858    then
859     if [ -f ${ubootScript} ]
860     then
861     cfguBoot=1
862     else
863     mountEntry=$(mount | grep ${ubootDir})
864     if [[ -z ${mountEntry} ]]
865     then
866     mount ${ubootDevice} ${ubootDir}
867     mounted=1
868     fi
869     [ -f ${ubootScript} ] && cfguBoot=1
870     fi
871    fi
872    
873  # 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
874  # is lilo to determine if it should be run  # is lilo to determine if it should be run
# Line 539  then Line 888  then
888   update   update
889  fi  fi
890    
891    # if we mounted the U-Boot directory, unmount it.
892    [[ -n ${mounted} ]] && umount ${ubootDir}
893    
894  exit 0  exit 0

Legend:
Removed from v.1332  
changed lines
  Added in v.1803