Magellan Linux

Diff of /trunk/grubby/new-kernel-pkg

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

revision 1691 by niro, Fri Feb 17 23:10:15 2012 UTC revision 2240 by niro, Mon Oct 21 13:35:28 2013 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 42  fi Line 68  fi
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    
# Line 59  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 79  then Line 112  then
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=""
# Line 96  else Line 130  else
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"
# Line 111  moddep="" Line 148  moddep=""
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    
# Line 130  usage() Line 167  usage()
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)
# Line 176  install() Line 204  install()
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
# Line 188  install() Line 217  install()
217   cfgLilo=""   cfgLilo=""
218   fi   fi
219    
220     if [[ -n ${banner} ]]
221     then
222     title="${banner} [ ${version} ]"
223     elif [[ $(read_os_release id) = magellan ]]
224     then
225     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
226     elif [ -f /etc/mageversion ]
227     then
228     title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
229     else
230     title="Magellan Linux [ ${version} ]"
231     fi
232    
233   if [[ -n ${cfgGrub} ]]   if [[ -n ${cfgGrub} ]]
234   then   then
235   [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}"
236    
237   if [[ -n ${banner} ]]   ${grubby} --grub -c ${grubConfig} \
238   then   --add-kernel=${bootPrefix}/${kernelName}-${version} \
  title="${banner} (${version})"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) (${version})"  
  else  
  title="Magellan Linux (${version})"  
  fi  
  ${grubby} --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     ${grubby} --grub2 -c ${grub2Config} \
250     --add-kernel=${bootPrefix}/${kernelName}-${version} \
251     ${INITRD} --copy-default ${makedefault} --title "${title}" \
252     ${mbkernel:+--add-multiboot="${mbkernel}"} \
253     ${mbargs:+--mbargs="${mbargs}"} \
254     --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
255     else
256     [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2"
257     fi
258     if [[ -n ${cfgGrub2Efi} ]]
259     then
260     [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"
261    
262     ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
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 "${grub2EfiConfig} does not exist, not running grubby for grub 2 with UEFI"
270   fi   fi
271    
272   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
# Line 232  install() Line 292  install()
292   else   else
293   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby"
294   fi   fi
295    
296     if [[ -n ${cfgExtlinux} ]]
297     then
298     [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"
299    
300     ${grubby} --extlinux -c ${extlinuxConfig} \
301     --add-kernel=${bootPrefix}/${kernelName}-${version} \
302     ${INITRD} --copy-default ${makedefault} --title "${title}" \
303     ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
304     --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
305     else
306     [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"
307     fi
308  }  }
309    
310  remove()  remove()
# Line 244  remove() Line 317  remove()
317   return   return
318   fi   fi
319    
  # Run grub2's configuration update in parallel, if it is installed  
  run_grub2  
   
320   if [[ -n ${cfgGrub} ]]   if [[ -n ${cfgGrub} ]]
321   then   then
322   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"
323   ${grubby} --remove-kernel=${bootPrefix}/${kernelName}-${version}   ${grubby} --grub -c ${grubConfig} \
324     --remove-kernel=${bootPrefix}/${kernelName}-${version}
325   else   else
326   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97"
327     fi
328     if [[ -n ${cfgGrub2} ]]
329     then
330     [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"
331     ${grubby} --grub2 -c ${grub2Config} \
332     --remove-kernel=${bootPrefix}/${kernelName}-${version}
333     else
334     [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2"
335     fi
336     if [[ -n ${cfgGrub2Efi} ]]
337     then
338     [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"
339     ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
340     --remove-kernel=${bootPrefix}/${kernelName}-${version}
341     else
342     [[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby grub 2 with UEFI"
343   fi   fi
344    
345   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
# Line 282  remove() Line 369  remove()
369   then   then
370   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)
371   curversion=$(tail -n1 ${ubootDir}/${ubootKList})   curversion=$(tail -n1 ${ubootDir}/${ubootKList})
372   sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList}   sed "/$version$/d" ${ubootDir}/${ubootKList} > ${tmpKList}
373   newversion=$(tail -n1 ${tmpKList})   newversion=$(tail -n1 ${tmpKList})
374   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]
375   then   then
# Line 322  remove() Line 409  remove()
409   [ -f ${tmpKList} ] && rm -f ${tmpKList}   [ -f ${tmpKList} ] && rm -f ${tmpKList}
410   fi   fi
411   else   else
412   [[ -n ${verbose} ]] && echo "No previous kernel version. uBoot images not removed!"   [[ -n ${verbose} ]] && echo "No previous kernel version.  U-Boot images not removed!"
413   fi   fi
414   else   else
415   [[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not modifying ${ubootDir}"   [[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not modifying ${ubootDir}"
416   fi   fi
417    
418     if [[ -n ${cfgExtlinux} ]]
419     then
420     [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"
421     ${grubby} --extlinux -c ${extlinuxConfig} \
422     --remove-kernel=${bootPrefix}/${kernelName}-${version}
423     else
424     [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"
425     fi
426  }  }
427    
428  update()  update()
# Line 349  update() Line 445  update()
445   fi   fi
446   fi   fi
447    
  # Run grub2's configuration update in parallel, if it is installed  
  run_grub2  
   
448   if [[ -n ${cfgGrub} ]]   if [[ -n ${cfgGrub} ]]
449   then   then
450   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"
451   ${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \   ${grubby} --grub -c ${grubConfig} \
452     --update-kernel=${bootPrefix}/${kernelName}-${version} \
453   ${INITRD} \   ${INITRD} \
454   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
455   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 363  update() Line 457  update()
457   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"
458   fi   fi
459    
460     if [[ -n ${cfgGrub2} ]]
461     then
462     [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"
463     ${grubby} --grub2 -c ${grub2Config} \
464     --update-kernel=${bootPrefix}/${kernelName}-${version} \
465     ${INITRD} \
466     ${kernargs:+--args="${kernargs}"} \
467     ${removeargs:+--remove-args="${removeargs}"}
468     else
469     [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby"
470     fi
471    
472     if [[ -n ${cfgGrub2Efi} ]]
473     then
474     [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"
475     ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
476     --update-kernel=${bootPrefix}/${kernelName}-${version} \
477     ${INITRD} \
478     ${kernargs:+--args="${kernargs}"} \
479     ${removeargs:+--remove-args="${removeargs}"}
480     else
481     [[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby"
482     fi
483    
484   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
485   then   then
486   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"
# Line 391  update() Line 509  update()
509   [[ -n ${verbose} ]] && echo "adding $version to ${ubootDir}..."   [[ -n ${verbose} ]] && echo "adding $version to ${ubootDir}..."
510    
511   [[ -n ${verbose} ]] && echo "creating uImage-${version}"   [[ -n ${verbose} ]] && echo "creating uImage-${version}"
512   mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 \   mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \
513   -n ${version} -d ${bootPrefix}/${kernelName}-${version} ${ubootDir}/uImage-${version}   -e ${ubootAddress} -n ${version} \
514     -d ${bootPrefix}/${kernelName}-${version} ${ubootDir}/uImage-${version}
515    
516   [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"   [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"
517   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 \
# Line 417  update() Line 536  update()
536   else   else
537   [[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not setting up ${ubootDir}"   [[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not setting up ${ubootDir}"
538   fi   fi
539    
540     if [[ -n ${cfgExtlinux} ]]
541     then
542     [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"
543     ${grubby} --extlinux -c ${extlinuxConfig} \
544     --update-kernel=${bootPrefix}/${kernelName}-${version} \
545     ${INITRD} \
546     ${kernargs:+--args="${kernargs}"} \
547     ${removeargs:+--remove-args="${removeargs}"}
548     else
549     [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby"
550     fi
551  }  }
552    
553  mkinitrd()  makeinitrd()
554  {  {
555   if [[ -n ${dracut} ]]   if [[ -n ${dracut} ]]
556   then   then
557   tool="/sbin/dracut ${dracuthostonly} -f ${initrdfile} ${version}"   tool="dracut ${dracuthostonly} -f ${initrdfile} ${version}"
558   else   else
559   tool="/sbin/mkinitrd --allow-missing -f ${initrdfile} ${version}"   tool="mkinitrd --allow-missing -f ${initrdfile} ${version}"
560   fi   fi
561   [[ -n ${verbose} ]] && echo "creating initrd ${initrdfile} using ${version}"   [[ -n ${verbose} ]] && echo "creating initrd ${initrdfile} using ${version}"
562   ${tool}   ${tool}
# Line 476  do Line 607  do
607   ;;   ;;
608    
609   --initrdfile*)   --initrdfile*)
610   if echo $1 | grep '=' >/dev/null   if [[ $1 == --initrdfile\=* ]]
611   then   then
612   initrdfile=$(echo $1 | sed 's/^--initrdfile=//')   initrdfile=${1#--initrdfile=}
613   else   else
614   initrdfile=$2   initrdfile=$2
615   shift   shift
# Line 486  do Line 617  do
617   ;;   ;;
618    
619   --kernel-args*)   --kernel-args*)
620   if echo $1 | grep '=' >/dev/null   if [[ $1 == --kernel-args\=* ]]
621   then   then
622   kernargs=$(echo $1 | sed 's/^--kernel-args=//')   kernargs=${1#--kernel-args=}
623   else   else
624   kernargs=$2   kernargs=$2
625   shift   shift
# Line 496  do Line 627  do
627   ;;   ;;
628    
629   --remove-args*)   --remove-args*)
630   if echo $1 | grep '=' >/dev/null   if [[ $1 == --remove-args\=* ]]
631   then   then
632   removeargs=$(echo $1 | sed 's/^--remove-args=//')   removeargs=${1#--remove-args=}
633   else   else
634   removeargs=$2   removeargs=$2
635   shift   shift
# Line 506  do Line 637  do
637   ;;   ;;
638    
639   --banner*)   --banner*)
640   if echo $1 | grep '=' >/dev/null   if [[ $1 == --banner\=* ]]
641   then   then
642   banner=$(echo $1 | sed 's/^--banner=//')   banner=${1#--banner=}
643   else   else
644   banner=$2   banner=$2
645   shift   shift
# Line 516  do Line 647  do
647   ;;   ;;
648    
649   --multiboot*)   --multiboot*)
650   if echo $1 |grep '=' >/dev/null   if [[ $1 == --multiboot\=* ]]
651   then   then
652   mbkernel=$(echo $1 | sed 's/^--multiboot=//')   mbkernel=${1#--multiboot=}
653   else   else
654   # can't really support having an optional second arg here   # can't really support having an optional second arg here
655   # sorry!   # sorry!
# Line 527  do Line 658  do
658   ;;   ;;
659    
660   --mbargs*)   --mbargs*)
661   if echo $1 |grep '=' >/dev/null   if [[ $1 == --mbargs\=* ]]
662   then   then
663   mbargs=$(echo $1 | sed 's/^--mbargs=//')   mbargs=${1#--mbargs=}
664   else   else
665   mbargs="$2"   mbargs="$2"
666   shift   shift
# Line 548  do Line 679  do
679   makedefault="--make-default"   makedefault="--make-default"
680   ;;   ;;
681    
682   --package)   --package*)
683   if echo $1 | grep '=' >/dev/null   if [[ $1 == --package\=* ]]
684   then   then
685   package=$(echo $1 | sed 's/^--package=//')   package=${1#--package=}
686   else   else
687   package=$2   package=$2
688   shift   shift
# Line 634  fi Line 765  fi
765  # add dracut i18n, keyboard and plymouth kernel args if requested  # add dracut i18n, keyboard and plymouth kernel args if requested
766  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]
767  then  then
768   [ -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} ]]  
769   then   then
770   kernargs="${kernargs} KEYTABLE=${KEYMAP}"   . /etc/vconsole.conf
771    
772     for i in SYSFONT SYSFONTACM UNIMAP KEYTABLE
773     do
774     val=$(eval echo \$$i)
775     [[ -n ${val} ]] && kernargs="${kernargs} ${i}=${val}"
776     done
777     else
778     if [ -r /etc/conf.d/consolefont ]
779     then
780     . /etc/conf.d/consolefont
781    
782     if [[ -n ${CONSOLEFONT} ]]
783     then
784     kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"
785     fi
786     fi
787    
788     if  [ -r /etc/conf.d/keymap ]
789     then
790     . /etc/conf.d/keymap
791    
792     if [[ -n ${KEYMAP} ]]
793     then
794     kernargs="${kernargs} KEYTABLE=${KEYMAP}"
795     fi
796     fi
797   fi   fi
798    
799   if [[ -n ${CONSOLEFONT} ]]   if [ -r /etc/locale.conf ]
800   then   then
801   kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"   . /etc/locale.conf
802    
803     if [[ -n ${LANG} ]]
804     then
805     kernargs="${kernargs} LANG=${LANG}"
806     fi
807   fi   fi
808  fi  fi
809    
# Line 666  fi Line 825  fi
825    
826  if [[ ${initrd} = make ]]  if [[ ${initrd} = make ]]
827  then  then
828   mkinitrd   makeinitrd
829  elif [[ ${initrd} = remove ]]  elif [[ ${initrd} = remove ]]
830  then  then
831   rminitrd   rminitrd
# Line 679  then Line 838  then
838  fi  fi
839    
840  [[ -n ${grubConfig} ]] && [ -f ${grubConfig} ] && cfgGrub=1  [[ -n ${grubConfig} ]] && [ -f ${grubConfig} ] && cfgGrub=1
841    [[ -n ${grub2Config} ]] && [ -f ${grub2Config} ] && cfgGrub2=1
842    [[ -n ${grub2EfiConfig} ]] && [ -f ${grub2EfiConfig} ] && cfgGrub2Efi=1
843  [[ -n ${liloConfig} ]] && [ -f ${liloConfig} ] && cfgLilo=1  [[ -n ${liloConfig} ]] && [ -f ${liloConfig} ] && cfgLilo=1
844    [[ -n ${extlinuxConfig} ]] && [ -f ${extlinuxConfig} ] && cfgExtlinux=1
845    
846  # 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
847  # 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.
848  if [[ -n ${ubootDir} ]]  if [[ -n ${ubootDir} ]]
849  then  then
850   mountEntry=$(mount | grep ${ubootDir})   if [ -f ${ubootScript} ]
  if [[ -z ${mountEntry} ]]  
851   then   then
852   mount ${ubootDevice} ${ubootDir}   cfguBoot=1
853   mounted=1   else
854     mountEntry=$(mount | grep ${ubootDir})
855     if [[ -z ${mountEntry} ]]
856     then
857     mount ${ubootDevice} ${ubootDir}
858     mounted=1
859     fi
860     [ -f ${ubootScript} ] && cfguBoot=1
861     fi
862    fi
863    
864    # if we're using U-Boot, check if the default load address should change
865    if [[ -n ${cfguBoot} ]] && [[ -z ${UBOOT_IMGADDR} ]]
866    then
867     [[ ${version}  =~ .([^.]*)$ ]]
868     platform=${BASH_REMATCH[1]}
869     # A few platforms use an alternate kernel load address
870     if [[ ${platform} = omap ]]
871     then
872     ubootAddress=0x80008000
873     elif [[ ${platform} = imx ]]
874     then
875     ubootAddress=0x90008000
876   fi   fi
  [ -f ${ubootScript} ] && cfguBoot=1  
877  fi  fi
878    
879  # 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
# Line 712  then Line 894  then
894   update   update
895  fi  fi
896    
897    # if we mounted the U-Boot directory, unmount it.
898    [[ -n ${mounted} ]] && umount ${ubootDir}
899    
900  exit 0  exit 0

Legend:
Removed from v.1691  
changed lines
  Added in v.2240