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 1848 by niro, Mon Jul 2 13:07:56 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} =~ armv[5|7].*l ]]
116    then
117     liloConfig=""
118     bootPrefix=/boot
119     ubootDir=${UBOOT_DIR:-"/boot"}
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 [[ -z ${UBOOT_IMGADDR} ]]
129     then
130     machine=${MACHINE:-$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')}
131     # A few machines use an alternate kernel load address
132     if [[ "${machine}" =~ ^OMAP[3|4].* ]]
133     then
134     ubootAddress=0x80008000
135     elif [[ "${machine}" =~ ^Efika\ MX.* ]]
136     then
137     ubootAddress=0x90008000
138     else
139     ubootAddress=0x00008000
140     fi
141     else
142     ubootAddress="${UBOOT_IMGADDR}"
143     fi
144  else  else
145   # this leaves i?86 and x86_64   # this leaves i?86 and x86_64
146   liloConfig=/etc/lilo.conf   liloConfig=/etc/lilo.conf
147   grubConfig=/boot/grub/grub.conf   grubConfig=/boot/grub/grub.conf
148     grub2Config=/boot/grub/grub.cfg
149     grub2EfiConfig=/boot/grub/grub-efi.cfg
150     extlinuxConfig=/boot/extlinux/extlinux.conf
151   bootPrefix=/boot   bootPrefix=/boot
152   liloFlag=lilo   liloFlag=lilo
153   isx86="yes"   isx86="yes"
# Line 89  fi Line 156  fi
156  mode=""  mode=""
157  version=""  version=""
158  initrd=""  initrd=""
159    dracut=""
160    dracuthostonly=""
161  initrdfile=""  initrdfile=""
162  moddep=""  moddep=""
163  verbose=""  verbose=""
164  makedefault=""  makedefault=""
165  package=""  package=""
166  mbkernel=""  mbkernel="${HYPERVISOR}"
167  mbargs=""  mbargs="${HYPERVISOR_ARGS}"
168    adddracutargs=""
169    addplymouthinitrd=""
170    
171  usage()  usage()
172  {  {
173   echo "Usage: $(basename $0) [-v] [--mkinitrd] [--rminitrd]" >&2   echo "Usage: $(basename $0) [-v] [--mkinitrd] [--rminitrd] [--dracut]" >&2
174   echo "       [--initrdfile=<initrd-image>] [--depmod] [--rmmoddep]" >&2   echo "       [--initrdfile=<initrd-image>] [--depmod] [--rmmoddep]" >&2
175   echo "       [--kernel-args=<args>] [--remove-args=<args>]" >&2   echo "       [--kernel-args=<args>] [--remove-args=<args>]" >&2
176   echo "       [--banner=<banner>] [--multiboot=multiboot]" >&2   echo "       [--banner=<banner>] [--multiboot=multiboot]" >&2
177   echo "       [--mbargs=mbargs] [--make-default]" >&2   echo "       [--mbargs=mbargs] [--make-default] [--add-dracut-args]" >&2
178     echo "       [--add-plymouth-initrd]" >&2
179     echo "       [--host-only]" >&2
180   echo "       <--install | --remove | --update> <kernel-version>" >&2   echo "       <--install | --remove | --update> <kernel-version>" >&2
181   echo "       (ex: $(basename $0) --mkinitrd --depmod --install 2.4.7-2)" >&2   echo "       (ex: $(basename $0) --mkinitrd --depmod --install 2.4.7-2)" >&2
182   exit 1   exit 1
183  }  }
184    
 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  
 }  
   
185  install()  install()
186  {  {
187   # 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 196  install()
196   then   then
197   [[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby"   [[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby"
198   INITRD="--initrd ${initrdfile}"   INITRD="--initrd ${initrdfile}"
199    
200     if [[ -n ${addplymouthinitrd} ]]
201     then
202     INITRD="${INITRD} --extra-initrd ${bootPrefix}/initrd-plymouth.img"
203     fi
204   fi   fi
205    
206   # 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 219  install()
219   return   return
220   fi   fi
221    
  # Run grub2's configuration update in parallel, if it is installed  
  run_grub2  
   
222   # get the root filesystem to use   # get the root filesystem to use
223   rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab)   rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab)
224    
# Line 168  install() Line 234  install()
234    
235   if [[ -n ${banner} ]]   if [[ -n ${banner} ]]
236   then   then
237   title="${banner} (${version})"   title="${banner} [ ${version} ]"
238   elif [ -f /etc/mageversion ]   elif [ -f /etc/mageversion ]
239   then   then
240   title="Magellan Linux $(< /etc/mageversion) (${version})"   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
241     elif [[ $(read_os_release id) = magellan ]]
242     then
243     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
244   else   else
245   title="Magellan Linux (${version})"   title="Magellan Linux [ ${version} ]"
246   fi   fi
247   ${grubby} --add-kernel=${bootPrefix}/${kernelName}-${version} \   ${grubby} --grub -c ${grubConfig} \
248     --add-kernel=${bootPrefix}/${kernelName}-${version} \
249   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
250   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
251   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
252   else   else
253   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97"
254     fi
255     if [[ -n ${cfgGrub2} ]]
256     then
257     [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}"
258    
259     if [[ -n ${banner} ]]
260     then
261     title="${banner} [ ${version} ]"
262     elif [ -f /etc/mageversion ]
263     then
264     title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
265     elif [[ $(read_os_release id) = magellan ]]
266     then
267     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
268     else
269     title="Magellan Linux [ ${version} ]"
270     fi
271     ${grubby} --grub2 -c ${grub2Config} \
272     --add-kernel=${bootPrefix}/${kernelName}-${version} \
273     ${INITRD} --copy-default ${makedefault} --title "${title}" \
274     ${mbkernel:+--add-multiboot="${mbkernel}"} \
275     ${mbargs:+--mbargs="${mbargs}"} \
276     --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
277     else
278     [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2"
279     fi
280     if [[ -n ${cfgGrub2Efi} ]]
281     then
282     [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"
283    
284     if [[ -n ${banner} ]]
285     then
286     title="${banner} [ ${version} ]"
287     elif [ -f /etc/mageversion ]
288     then
289     title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
290     elif [[ $(read_os_release id) = magellan ]]
291     then
292     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
293     else
294     title="Magellan Linux [ ${version} ]"
295     fi
296     ${grubby} --grub2 -c ${grub2EfiConfig} \
297     --add-kernel=${bootPrefix}/${kernelName}-${version} \
298     ${INITRD} --copy-default ${makedefault} --title "${title}" \
299     ${mbkernel:+--add-multiboot="${mbkernel}"} \
300     ${mbargs:+--mbargs="${mbargs}"} \
301     --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
302     else
303     [[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby for grub 2 with UEFI"
304   fi   fi
305    
306   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
# Line 206  install() Line 326  install()
326   else   else
327   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"
328   fi   fi
329    
330     if [[ -n ${cfgExtlinux} ]]
331     then
332     [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"
333    
334     if [[ -n ${banner} ]]
335     then
336     title="${banner} [ ${version} ]"
337     elif [ -f /etc/mageversion ]
338     then
339     title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
340     elif [[ $(read_os_release id) = magellan ]]
341     then
342     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
343     else
344     title="Magellan Linux [ ${version} ]"
345     fi
346     ${grubby} --extlinux -c ${extlinuxConfig} \
347     --add-kernel=${bootPrefix}/${kernelName}-${version} \
348     ${INITRD} --copy-default ${makedefault} --title "${title}" \
349     ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
350     --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
351     else
352     [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"
353     fi
354  }  }
355    
356  remove()  remove()
# Line 218  remove() Line 363  remove()
363   return   return
364   fi   fi
365    
  # Run grub2's configuration update in parallel, if it is installed  
  run_grub2  
   
366   if [[ -n ${cfgGrub} ]]   if [[ -n ${cfgGrub} ]]
367   then   then
368   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"
369   ${grubby} --remove-kernel=${bootPrefix}/${kernelName}-${version}   ${grubby} --grub -c ${grubConfig} \
370     --remove-kernel=${bootPrefix}/${kernelName}-${version}
371   else   else
372   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97"
373     fi
374     if [[ -n ${cfgGrub2} ]]
375     then
376     [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"
377     ${grubby} --grub2 -c ${grub2Config} \
378     --remove-kernel=${bootPrefix}/${kernelName}-${version}
379     else
380     [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2"
381     fi
382     if [[ -n ${cfgGrub2Efi} ]]
383     then
384     [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"
385     ${grubby} --grub2 -c ${grub2EfiConfig} \
386     --remove-kernel=${bootPrefix}/${kernelName}-${version}
387     else
388     [[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby grub 2 with UEFI"
389   fi   fi
390    
391   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
# Line 247  remove() Line 406  remove()
406   else   else
407   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"
408   fi   fi
409    
410     if [[ -n ${cfguBoot} ]]
411     then
412     [[ -n ${verbose} ]] && echo "removing ${version} from ${ubootDir}..."
413    
414     if [ -f ${ubootDir}/${ubootKList} ]
415     then
416     tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)
417     curversion=$(tail -n1 ${ubootDir}/${ubootKList})
418     sed "/$version$/d" ${ubootDir}/${ubootKList} > ${tmpKList}
419     newversion=$(tail -n1 ${tmpKList})
420     if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]
421     then
422     if [[ ${curversion} != ${newversion} ]]
423     then
424     cp -fp ${ubootDir}/uImage-${newversion} ${ubootDir}/${ubootDefaultImage}
425     if [ $? -ne 0 ]
426     then
427     [[ -n ${verbose} ]] && echo "copy uImage-${newversion} error, default kernel not replaced!" && exit
428     fi
429     cp -fp ${ubootDir}/uInitrd-${newversion} ${ubootDir}/${ubootDefaultInitrd}
430     if [ $? -ne 0 ]
431     then
432     [[ -n ${verbose} ]] && echo "copy uInitrd-${newversion} error, default Initrd not replaced!" && exit
433     fi
434     fi
435    
436     [[ -n ${verbose} ]] && echo "removing uImage-${version}"
437     if [ -f ${ubootDir}/uImage-${version} ]
438     then
439     rm -f ${ubootDir}/uImage-${version}
440     else
441     [[ -n ${verbose} ]] && echo "uImage-${version} did not exist!"
442     fi
443    
444     [[ -n ${verbose} ]] && echo "removing uInitrd-${version}"
445     if [ -f ${ubootDir}/uInitrd-${version} ]
446     then
447     rm -f ${ubootDir}/uInitrd-${version}
448     else
449     [[ -n ${verbose} ]] && echo "uInitrd-${version} did not exist!"
450     fi
451    
452     mv ${tmpKList} ${ubootDir}/${ubootKList}
453     else
454     [[ -n ${verbose} ]] && echo "uImage ${newversion} does not exist!"
455     [ -f ${tmpKList} ] && rm -f ${tmpKList}
456     fi
457     else
458     [[ -n ${verbose} ]] && echo "No previous kernel version.  U-Boot images not removed!"
459     fi
460     else
461     [[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not modifying ${ubootDir}"
462     fi
463    
464     if [[ -n ${cfgExtlinux} ]]
465     then
466     [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"
467     ${grubby} --extlinux -c ${extlinuxConfig} \
468     --remove-kernel=${bootPrefix}/${kernelName}-${version}
469     else
470     [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"
471     fi
472  }  }
473    
474  update()  update()
# Line 262  update() Line 484  update()
484   then   then
485   [[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby"   [[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby"
486   INITRD="--initrd ${initrdfile}"   INITRD="--initrd ${initrdfile}"
  fi  
487    
488   # Run grub2's configuration update in parallel, if it is installed   if [[ -n ${addplymouthinitrd} ]]
489   run_grub2   then
490     INITRD="${INITRD} --extra-initrd ${bootPrefix}/initrd-plymouth.img"
491     fi
492     fi
493    
494   if [[ -n ${cfgGrub} ]]   if [[ -n ${cfgGrub} ]]
495   then   then
496   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"
497   ${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \   ${grubby} --grub -c ${grubConfig} \
498     --update-kernel=${bootPrefix}/${kernelName}-${version} \
499   ${INITRD} \   ${INITRD} \
500   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
501   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 278  update() Line 503  update()
503   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"
504   fi   fi
505    
506     if [[ -n ${cfgGrub2} ]]
507     then
508     [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"
509     ${grubby} --grub2 -c ${grub2Config} \
510     --update-kernel=${bootPrefix}/${kernelName}-${version} \
511     ${INITRD} \
512     ${kernargs:+--args="${kernargs}"} \
513     ${removeargs:+--remove-args="${removeargs}"}
514     else
515     [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby"
516     fi
517    
518     if [[ -n ${cfgGrub2Efi} ]]
519     then
520     [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"
521     ${grubby} --grub2 -c ${grub2EfiConfig} \
522     --update-kernel=${bootPrefix}/${kernelName}-${version} \
523     ${INITRD} \
524     ${kernargs:+--args="${kernargs}"} \
525     ${removeargs:+--remove-args="${removeargs}"}
526     else
527     [[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby"
528     fi
529    
530   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
531   then   then
532   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"
# Line 300  update() Line 549  update()
549   else   else
550   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"
551   fi   fi
552    
553     if [[ -n ${cfguBoot} ]]
554     then
555     [[ -n ${verbose} ]] && echo "adding $version to ${ubootDir}..."
556    
557     [[ -n ${verbose} ]] && echo "creating uImage-${version}"
558     mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \
559     -e ${ubootAddress} -n ${version} \
560     -d ${bootPrefix}/${kernelName}-${version} ${ubootDir}/uImage-${version}
561    
562     [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"
563     mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 \
564     -n initramfs -d ${initrdfile} ${ubootDir}/uInitrd-${version}
565    
566     if [ -f ${ubootDir}/uImage-${version} ] && [ -f ${ubootDir}/uInitrd-${version} ]
567     then
568     cp -fp ${ubootDir}/uImage-${version} ${ubootDir}/${ubootDefaultImage}
569     if [ $? -ne 0 ]
570     then
571     [[ -n ${verbose} ]] && echo "copy uImage-${version} error, kernel not installed!" && exit
572     fi
573     cp -fp ${ubootDir}/uInitrd-${version} ${ubootDir}/${ubootDefaultInitrd}
574     if [ $? -ne 0 ]
575     then
576     [[ -n ${verbose} ]] && echo "copy uInitrd-${version} error, kernel not installed!" && exit
577     fi
578     echo ${version} >> ${ubootDir}/${ubootKList}
579     else
580     [[ -n ${verbose} ]] && echo "cannot make ${version} the default"
581     fi
582     else
583     [[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not setting up ${ubootDir}"
584     fi
585    
586     if [[ -n ${cfgExtlinux} ]]
587     then
588     [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"
589     ${grubby} --extlinux -c ${extlinuxConfig} \
590     --update-kernel=${bootPrefix}/${kernelName}-${version} \
591     ${INITRD} \
592     ${kernargs:+--args="${kernargs}"} \
593     ${removeargs:+--remove-args="${removeargs}"}
594     else
595     [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby"
596     fi
597  }  }
598    
599  mkinitrd()  makeinitrd()
600  {  {
601     if [[ -n ${dracut} ]]
602     then
603     tool="dracut ${dracuthostonly} -f ${initrdfile} ${version}"
604     else
605     tool="mkinitrd --allow-missing -f ${initrdfile} ${version}"
606     fi
607   [[ -n ${verbose} ]] && echo "creating initrd ${initrdfile} using ${version}"   [[ -n ${verbose} ]] && echo "creating initrd ${initrdfile} using ${version}"
608   /sbin/mkinitrd --allow-missing -f ${initrdfile} ${version}   ${tool}
609   rc=$?   rc=$?
610   if [ ${rc} != 0 ]   if [ ${rc} != 0 ]
611   then   then
# Line 344  do Line 644  do
644   initrd="remove"   initrd="remove"
645   ;;   ;;
646    
647     --dracut)
648     dracut=--dracut
649     ;;
650    
651     --host-only)
652     dracuthostonly=-H
653     ;;
654    
655   --initrdfile*)   --initrdfile*)
656   if echo $1 | grep '=' >/dev/null   if echo $1 | grep '=' >/dev/null
657   then   then
# Line 427  do Line 735  do
735   fi   fi
736   ;;   ;;
737    
738     --add-dracut-args)
739     adddracutargs=--add-dracut-args
740     ;;
741    
742     --add-plymouth-initrd)
743     addplymouthinitrd=--add-plymouth-initrd
744     ;;
745    
746   -v)   -v)
747   verbose=-v   verbose=-v
748   ;;   ;;
# Line 478  fi Line 794  fi
794  if [[ -z ${initrdfile} ]]  if [[ -z ${initrdfile} ]]
795  then  then
796   INITRD_NAME_PREFIX="initrd"   INITRD_NAME_PREFIX="initrd"
797     if [[ -n ${dracut} ]]
798     then
799     INITRD_NAME_PREFIX="initramfs"
800     fi
801    
802   if [[ $(uname -m) = ia64 ]]   if [[ $(uname -m) = ia64 ]]
803   then   then
# Line 488  then Line 808  then
808  fi  fi
809  [[ -n ${verbose} ]] && echo "initrdfile is ${initrdfile}"  [[ -n ${verbose} ]] && echo "initrdfile is ${initrdfile}"
810    
811    # add dracut i18n, keyboard and plymouth kernel args if requested
812    if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]
813    then
814     [ -r /etc/conf.d/keymap ] && . /etc/conf.d/keymap
815     [ -r /etc/conf.d/consolefont ] && . /etc/conf.d/consolefont
816    
817     if [[ -n ${KEYMAP} ]]
818     then
819     kernargs="${kernargs} KEYTABLE=${KEYMAP}"
820     fi
821    
822     if [[ -n ${CONSOLEFONT} ]]
823     then
824     kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"
825     fi
826    fi
827    
828  # 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
829  if [[ ${mode} = --install ]] && [[ ${UPDATEDEFAULT} = yes ]] && [[ -n ${package} ]] &&  if [[ ${mode} = --install ]] && [[ ${UPDATEDEFAULT} = yes ]] && [[ -n ${package} ]] &&
830   [[ -n ${DEFAULTKERNEL} ]] && [[ ${package} = ${DEFAULTKERNEL} ]]   [[ -n ${DEFAULTKERNEL} ]] && [[ ${package} = ${DEFAULTKERNEL} ]]
# Line 506  fi Line 843  fi
843    
844  if [[ ${initrd} = make ]]  if [[ ${initrd} = make ]]
845  then  then
846   mkinitrd   makeinitrd
847  elif [[ ${initrd} = remove ]]  elif [[ ${initrd} = remove ]]
848  then  then
849   rminitrd   rminitrd
# Line 519  then Line 856  then
856  fi  fi
857    
858  [[ -n ${grubConfig} ]] && [ -f ${grubConfig} ] && cfgGrub=1  [[ -n ${grubConfig} ]] && [ -f ${grubConfig} ] && cfgGrub=1
859    [[ -n ${grub2Config} ]] && [ -f ${grub2Config} ] && cfgGrub2=1
860    [[ -n ${grub2EfiConfig} ]] && [ -f ${grub2EfiConfig} ] && cfgGrub2Efi=1
861  [[ -n ${liloConfig} ]] && [ -f ${liloConfig} ] && cfgLilo=1  [[ -n ${liloConfig} ]] && [ -f ${liloConfig} ] && cfgLilo=1
862    [[ -n ${extlinuxConfig} ]] && [ -f ${extlinuxConfig} ] && cfgExtlinux=1
863    
864    # if we have a U-Boot directory, but no boot script, check if the directory
865    # is mounted.  If not, mount it, and then check if a boot script exists.
866    if [[ -n ${ubootDir} ]]
867    then
868     if [ -f ${ubootScript} ]
869     then
870     cfguBoot=1
871     else
872     mountEntry=$(mount | grep ${ubootDir})
873     if [[ -z ${mountEntry} ]]
874     then
875     mount ${ubootDevice} ${ubootDir}
876     mounted=1
877     fi
878     [ -f ${ubootScript} ] && cfguBoot=1
879     fi
880    fi
881    
882  # 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
883  # is lilo to determine if it should be run  # is lilo to determine if it should be run
# Line 539  then Line 897  then
897   update   update
898  fi  fi
899    
900    # if we mounted the U-Boot directory, unmount it.
901    [[ -n ${mounted} ]] && umount ${ubootDir}
902    
903  exit 0  exit 0

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