Magellan Linux

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

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

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

Legend:
Removed from v.1305  
changed lines
  Added in v.1778