Magellan Linux

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

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

revision 1757 by niro, Sat Feb 18 11:57:40 2012 UTC revision 2684 by niro, Wed Jul 16 10:26:39 2014 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 65  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 85  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 ]]  elif [[ ${ARCH} =~ armv[5|7].*l ]]
116  then  then
  machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')  
117   liloConfig=""   liloConfig=""
118   bootPrefix=/boot   bootPrefix=/boot
119   ubootDir=${UBOOT_DIR:-"/boot/uboot"}   extlinuxConfig=$(readlink -f /etc/extlinux.conf 2>/dev/null)
120     ubootDir=${UBOOT_DIR:-"/boot"}
121   ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"}   ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"}
122   ubootKList=${UBOOT_KLIST:-"klist.txt"}   ubootKList=${UBOOT_KLIST:-"klist.txt"}
123   ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"}   ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"}
124   ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"}   ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"}
125   ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"}   ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"}
126     ubootAddress=${UBOOT_IMGADDR:-"0x00008000"}
127   mounted=""   mounted=""
128   liloFlag=""   liloFlag=""
129   isx86=""   isx86=""
  if [[ ${machine} == "OMAP3 Beagle Board" ]] || [[ ${machine} == "OMAP4 Panda board" ]]  
  then  
  ubootAddress=0x80008000  
  else  
  ubootAddress=0x00008000  
  fi  
130  else  else
131   # this leaves i?86 and x86_64   # this leaves i?86 and x86_64
132   liloConfig=/etc/lilo.conf   liloConfig=/etc/lilo.conf
# Line 149  usage() Line 171  usage()
171  install()  install()
172  {  {
173   # 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)
174   if [ ! -f ${bootPrefix}/${kernelName}-${version} ]   if [ ! -f ${kernelImage} ]
175   then   then
176   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"
177   return   return
# Line 174  install() Line 196  install()
196   if [[ -z ${initrdfile} ]]   if [[ -z ${initrdfile} ]]
197   then   then
198   [[ -n ${verbose} ]] && echo "No initrd, just adding system map"   [[ -n ${verbose} ]] && echo "No initrd, just adding system map"
199   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${bootPrefix}/${kernelName}-${version} ${bootPrefix}/vmlinitrd-${version}   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${kernelImage} ${bootPrefix}/vmlinitrd-${version}
200   else   else
201   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${bootPrefix}/${kernelName}-${version} ${bootPrefix}/vmlinux.sm-${version}   /sbin/addSystemMap ${bootPrefix}/System.map-${version} ${kernelImage} ${bootPrefix}/vmlinux.sm-${version}
202   /sbin/addRamDisk ${initrdfile} ${bootPrefix}/System.map-${version} ${bootPrefix}/vmlinux.sm-${version} ${bootPrefix}/vmlinitrd-${version} 2>/dev/null   /sbin/addRamDisk ${initrdfile} ${bootPrefix}/System.map-${version} ${bootPrefix}/vmlinux.sm-${version} ${bootPrefix}/vmlinitrd-${version} 2>/dev/null
203   rm ${bootPrefix}/vmlinux.sm-${version}   rm ${bootPrefix}/vmlinux.sm-${version}
204   fi   fi
# Line 184  install() Line 206  install()
206   fi   fi
207    
208   # get the root filesystem to use   # get the root filesystem to use
209   rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab)   rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab  2>/dev/null)
210     if [[ -z $rootdevice ]]
211     then
212     rootdevice=$(grep -o -P "(?<=root=)\S+" /proc/cmdline)
213     fi
214    
215   if [[ -n ${mbkernel} ]] && [[ -n ${cfgLilo} ]] && [[ ${liloFlag} != elilo ]]   if [[ -n ${mbkernel} ]] && [[ -n ${cfgLilo} ]] && [[ ${liloFlag} != elilo ]]
216   then   then
# Line 192  install() Line 218  install()
218   cfgLilo=""   cfgLilo=""
219   fi   fi
220    
221   if [[ -n ${cfgGrub} ]]   if [[ -n ${banner} ]]
222   then   then
223   [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}"   if [[ ${ARCH} = s390 ]] || [[ ${ARCH} = s390x ]]
   
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
224   then   then
225   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"   title=$(echo ${banner} | sed 's/ /_/g')
226   else   else
227   title="Magellan Linux [ ${version} ]"   title="${banner} [ ${version} ]"
228   fi   fi
229     elif [[ ${ARCH} = s390 ]] || [[ ${ARCH} = s390x ]]
230     then
231     title=$(echo ${version} | sed 's/ /_/g')
232     elif [ -f /etc/os-release ]
233     then
234     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
235     elif [ -f /etc/mageversion ]
236     then
237     title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
238     else
239     title="Magellan Linux [ ${version} ]"
240     fi
241    
242     if [[ -n ${cfgGrub} ]]
243     then
244     [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}"
245    
246   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
247   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
248   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
249   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
250   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
# Line 217  install() Line 255  install()
255   then   then
256   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}"
257    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
258   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
259   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
260   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
261   ${mbkernel:+--add-multiboot="${mbkernel}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} \
262   ${mbargs:+--mbargs="${mbargs}"} \   ${mbargs:+--mbargs="${mbargs}"} \
# Line 239  install() Line 268  install()
268   then   then
269   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"
270    
271   if [[ -n ${banner} ]]   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
272   then   --add-kernel=${kernelImage} \
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
  ${grubby} --grub2 -c ${grub2EfiConfig} \  
  --add-kernel=${bootPrefix}/${kernelName}-${version} \  
273   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
274   ${mbkernel:+--add-multiboot="${mbkernel}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} \
275   ${mbargs:+--mbargs="${mbargs}"} \   ${mbargs:+--mbargs="${mbargs}"} \
# Line 262  install() Line 282  install()
282   then   then
283   [[ -n ${verbose} ]] && echo "adding ${version} to ${liloConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${liloConfig}"
284    
285   ${grubby} --add-kernel=${bootPrefix}/${kernelName}-${version} ${INITRD} \   ${grubby} --add-kernel=${kernelImage} ${INITRD} \
286   --copy-default ${makedefault} --title ${version} \   --copy-default ${makedefault} --title "${title}" \
287   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
288   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${version}" \   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${version}" \
289   --${liloFlag}   --${liloFlag}
# Line 286  install() Line 306  install()
306   then   then
307   [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"
308    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
309   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
310   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
311   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
312   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
313   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
# Line 311  remove() Line 322  remove()
322   if [ -d /proc/iSeries ]   if [ -d /proc/iSeries ]
323   then   then
324   [[ -n ${verbose} ]] && echo "On an iSeries, remove img file"   [[ -n ${verbose} ]] && echo "On an iSeries, remove img file"
325   rm -f ${bootPrefix}/${kernelName}-${version}.img 2>/dev/null   rm -f ${kernelImage}.img 2>/dev/null
326   return   return
327   fi   fi
328    
# Line 319  remove() Line 330  remove()
330   then   then
331   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"
332   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
333   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
334   else   else
335   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97"
336   fi   fi
# Line 327  remove() Line 338  remove()
338   then   then
339   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"
340   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
341   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
342   else   else
343   [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2"   [[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2"
344   fi   fi
345   if [[ -n ${cfgGrub2Efi} ]]   if [[ -n ${cfgGrub2Efi} ]]
346   then   then
347   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"
348   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
349   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
350   else   else
351   [[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby grub 2 with UEFI"   [[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby grub 2 with UEFI"
352   fi   fi
# Line 343  remove() Line 354  remove()
354   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
355   then   then
356   [[ -n ${verbose} ]] && echo "removing ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${liloConfig}"
357   ${grubby} --remove-kernel=${bootPrefix}/${kernelName}-${version} --${liloFlag}   ${grubby} --remove-kernel=${kernelImage} --${liloFlag}
358    
359   if [[ -n ${runLilo} ]]   if [[ -n ${runLilo} ]]
360   then   then
# Line 367  remove() Line 378  remove()
378   then   then
379   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)
380   curversion=$(tail -n1 ${ubootDir}/${ubootKList})   curversion=$(tail -n1 ${ubootDir}/${ubootKList})
381   sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList}   sed "/$version$/d" ${ubootDir}/${ubootKList} > ${tmpKList}
382   newversion=$(tail -n1 ${tmpKList})   newversion=$(tail -n1 ${tmpKList})
383   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]
384   then   then
# Line 402  remove() Line 413  remove()
413   fi   fi
414    
415   mv ${tmpKList} ${ubootDir}/${ubootKList}   mv ${tmpKList} ${ubootDir}/${ubootKList}
416     [ -x /sbin/a-b-c ] && /sbin/a-b-c
417   else   else
418   [[ -n ${verbose} ]] && echo "uImage ${newversion} does not exist!"   [[ -n ${verbose} ]] && echo "uImage ${newversion} does not exist!"
419   [ -f ${tmpKList} ] && rm -f ${tmpKList}   [ -f ${tmpKList} ] && rm -f ${tmpKList}
# Line 417  remove() Line 429  remove()
429   then   then
430   [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"
431   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
432   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
433   else   else
434   [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"   [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"
435   fi   fi
# Line 425  remove() Line 437  remove()
437    
438  update()  update()
439  {  {
440   if [ ! -f ${bootPrefix}/${kernelName}-${version} ]   if [ ! -f ${kernelImage} ]
441   then   then
442   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"
443   return   return
# Line 447  update() Line 459  update()
459   then   then
460   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"
461   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
462   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
463   ${INITRD} \   ${INITRD} \
464   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
465   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"} \
466     ${mbkernel:+--add-multiboot="${mbkernel}"}
467   else   else
468   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"
469   fi   fi
# Line 459  update() Line 472  update()
472   then   then
473   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"
474   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
475   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
476   ${INITRD} \   ${INITRD} \
477   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
478   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 470  update() Line 483  update()
483   if [[ -n ${cfgGrub2Efi} ]]   if [[ -n ${cfgGrub2Efi} ]]
484   then   then
485   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"
486   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
487   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
488   ${INITRD} \   ${INITRD} \
489   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
490   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 482  update() Line 495  update()
495   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
496   then   then
497   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"
498   ${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \   ${grubby} --update-kernel=${kernelImage} \
499   ${INITRD} \   ${INITRD} \
500   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
501   ${removeargs:+--remove-args="${removeargs}"} \   ${removeargs:+--remove-args="${removeargs}"} \
# Line 509  update() Line 522  update()
522   [[ -n ${verbose} ]] && echo "creating uImage-${version}"   [[ -n ${verbose} ]] && echo "creating uImage-${version}"
523   mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \   mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \
524   -e ${ubootAddress} -n ${version} \   -e ${ubootAddress} -n ${version} \
525   -d ${bootPrefix}/${kernelName}-${version} ${ubootDir}/uImage-${version}   -d ${kernelImage} ${ubootDir}/uImage-${version}
526    
527   [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"   [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"
528   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 528  update() Line 541  update()
541   [[ -n ${verbose} ]] && echo "copy uInitrd-${version} error, kernel not installed!" && exit   [[ -n ${verbose} ]] && echo "copy uInitrd-${version} error, kernel not installed!" && exit
542   fi   fi
543   echo ${version} >> ${ubootDir}/${ubootKList}   echo ${version} >> ${ubootDir}/${ubootKList}
544     [ -x /sbin/a-b-c ] && /sbin/a-b-c
545   else   else
546   [[ -n ${verbose} ]] && echo "cannot make ${version} the default"   [[ -n ${verbose} ]] && echo "cannot make ${version} the default"
547   fi   fi
# Line 539  update() Line 553  update()
553   then   then
554   [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"
555   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
556   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
557   ${INITRD} \   ${INITRD} \
558   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
559   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 581  doDepmod() Line 595  doDepmod()
595  doRmmoddep()  doRmmoddep()
596  {  {
597   [[ -n ${verbose} ]] && echo "removing modules.dep info for ${version}"   [[ -n ${verbose} ]] && echo "removing modules.dep info for ${version}"
598   [ -d /lib/modules/${version} ] && rm -f /lib/modules/${version}/modules.*   if [ -d /lib/modules/${version} ]
599     then
600     rm -f /lib/modules/${version}/modules.*.bin \
601     /lib/modules/${version}/modules.{alias,dep,devname,symbols,softdep}
602     fi
603  }  }
604    
605    
# Line 605  do Line 623  do
623   ;;   ;;
624    
625   --initrdfile*)   --initrdfile*)
626   if echo $1 | grep '=' >/dev/null   if [[ $1 == --initrdfile\=* ]]
627   then   then
628   initrdfile=$(echo $1 | sed 's/^--initrdfile=//')   initrdfile=${1#--initrdfile=}
629   else   else
630   initrdfile=$2   initrdfile=$2
631   shift   shift
# Line 615  do Line 633  do
633   ;;   ;;
634    
635   --kernel-args*)   --kernel-args*)
636   if echo $1 | grep '=' >/dev/null   if [[ $1 == --kernel-args\=* ]]
637   then   then
638   kernargs=$(echo $1 | sed 's/^--kernel-args=//')   kernargs=${1#--kernel-args=}
639   else   else
640   kernargs=$2   kernargs=$2
641   shift   shift
# Line 625  do Line 643  do
643   ;;   ;;
644    
645   --remove-args*)   --remove-args*)
646   if echo $1 | grep '=' >/dev/null   if [[ $1 == --remove-args\=* ]]
647   then   then
648   removeargs=$(echo $1 | sed 's/^--remove-args=//')   removeargs=${1#--remove-args=}
649   else   else
650   removeargs=$2   removeargs=$2
651   shift   shift
# Line 635  do Line 653  do
653   ;;   ;;
654    
655   --banner*)   --banner*)
656   if echo $1 | grep '=' >/dev/null   if [[ $1 == --banner\=* ]]
657   then   then
658   banner=$(echo $1 | sed 's/^--banner=//')   banner=${1#--banner=}
659   else   else
660   banner=$2   banner=$2
661   shift   shift
# Line 645  do Line 663  do
663   ;;   ;;
664    
665   --multiboot*)   --multiboot*)
666   if echo $1 |grep '=' >/dev/null   if [[ $1 == --multiboot\=* ]]
667   then   then
668   mbkernel=$(echo $1 | sed 's/^--multiboot=//')   mbkernel=${1#--multiboot=}
669   else   else
670   # can't really support having an optional second arg here   # can't really support having an optional second arg here
671   # sorry!   # sorry!
# Line 656  do Line 674  do
674   ;;   ;;
675    
676   --mbargs*)   --mbargs*)
677   if echo $1 |grep '=' >/dev/null   if [[ $1 == --mbargs\=* ]]
678   then   then
679   mbargs=$(echo $1 | sed 's/^--mbargs=//')   mbargs=${1#--mbargs=}
680   else   else
681   mbargs="$2"   mbargs="$2"
682   shift   shift
# Line 677  do Line 695  do
695   makedefault="--make-default"   makedefault="--make-default"
696   ;;   ;;
697    
698   --package)   --package*)
699   if echo $1 | grep '=' >/dev/null   if [[ $1 == --package\=* ]]
700   then   then
701   package=$(echo $1 | sed 's/^--package=//')   package=${1#--package=}
702   else   else
703   package=$2   package=$2
704   shift   shift
# Line 695  do Line 713  do
713   addplymouthinitrd=--add-plymouth-initrd   addplymouthinitrd=--add-plymouth-initrd
714   ;;   ;;
715    
716     --kernel-image*)
717     if [[ $1 == --kernel-image\=* ]]
718     then
719     kernelImage=${1#--kernel-image=}
720     else
721     kernelImage="$2"
722     shift
723     fi
724     if ! [[ -f ${kernelImage} ]]
725     then
726     echo "Can't find kernel image '${kernelImage}'" >&2
727     usage
728     exit 1
729     fi
730     ;;
731    
732   -v)   -v)
733   verbose=-v   verbose=-v
734   ;;   ;;
# Line 742  then Line 776  then
776   fi   fi
777  fi  fi
778    
779    [[ ${kernelImage} ]] || kernelImage="${bootPrefix}/${kernelName}-${version}"
780    
781  # set the initrd file based on arch; ia64 is the only currently known oddball  # set the initrd file based on arch; ia64 is the only currently known oddball
782  if [[ -z ${initrdfile} ]]  if [[ -z ${initrdfile} ]]
783  then  then
# Line 763  fi Line 799  fi
799  # add dracut i18n, keyboard and plymouth kernel args if requested  # add dracut i18n, keyboard and plymouth kernel args if requested
800  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]
801  then  then
802   [ -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} ]]  
803   then   then
804   kernargs="${kernargs} KEYTABLE=${KEYMAP}"   . /etc/vconsole.conf
805    
806     for i in SYSFONT SYSFONTACM UNIMAP KEYTABLE
807     do
808     val=$(eval echo \$$i)
809     [[ -n ${val} ]] && kernargs="${kernargs} ${i}=${val}"
810     done
811     else
812     if [ -r /etc/conf.d/consolefont ]
813     then
814     . /etc/conf.d/consolefont
815    
816     if [[ -n ${CONSOLEFONT} ]]
817     then
818     kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"
819     fi
820     fi
821    
822     if  [ -r /etc/conf.d/keymap ]
823     then
824     . /etc/conf.d/keymap
825    
826     if [[ -n ${KEYMAP} ]]
827     then
828     kernargs="${kernargs} KEYTABLE=${KEYMAP}"
829     fi
830     fi
831   fi   fi
832    
833   if [[ -n ${CONSOLEFONT} ]]   if [ -r /etc/locale.conf ]
834   then   then
835   kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"   . /etc/locale.conf
836    
837     if [[ -n ${LANG} ]]
838     then
839     kernargs="${kernargs} LANG=${LANG}"
840     fi
841   fi   fi
842  fi  fi
843    
# Line 831  then Line 895  then
895   fi   fi
896  fi  fi
897    
898    # if we're using U-Boot, check if the default load address should change
899    if [[ -n ${cfguBoot} ]] && [[ -z ${UBOOT_IMGADDR} ]]
900    then
901     [[ ${version}  =~ .([^.]*)$ ]]
902     platform=${BASH_REMATCH[1]}
903     # A few platforms use an alternate kernel load address
904     if [[ ${platform} = omap ]]
905     then
906     ubootAddress=0x80008000
907     elif [[ ${platform} = imx ]]
908     then
909     ubootAddress=0x90008000
910     fi
911    fi
912    
913  # 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
914  # is lilo to determine if it should be run  # is lilo to determine if it should be run
915  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]

Legend:
Removed from v.1757  
changed lines
  Added in v.2684