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 2681 by niro, Wed Jul 16 09:48:55 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 ${banner} ]]
222     then
223     title="${banner} [ ${version} ]"
224     elif [ -f /etc/os-release ]
225     then
226     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
227     elif [ -f /etc/mageversion ]
228     then
229     title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
230     else
231     title="Magellan Linux [ ${version} ]"
232     fi
233    
234   if [[ -n ${cfgGrub} ]]   if [[ -n ${cfgGrub} ]]
235   then   then
236   [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}"
237    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
238   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
239   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
240   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
241   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
242   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
# Line 217  install() Line 247  install()
247   then   then
248   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}"
249    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
250   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
251   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
252   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
253   ${mbkernel:+--add-multiboot="${mbkernel}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} \
254   ${mbargs:+--mbargs="${mbargs}"} \   ${mbargs:+--mbargs="${mbargs}"} \
# Line 239  install() Line 260  install()
260   then   then
261   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}"
262    
263   if [[ -n ${banner} ]]   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
264   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} \  
265   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
266   ${mbkernel:+--add-multiboot="${mbkernel}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} \
267   ${mbargs:+--mbargs="${mbargs}"} \   ${mbargs:+--mbargs="${mbargs}"} \
# Line 262  install() Line 274  install()
274   then   then
275   [[ -n ${verbose} ]] && echo "adding ${version} to ${liloConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${liloConfig}"
276    
277   ${grubby} --add-kernel=${bootPrefix}/${kernelName}-${version} ${INITRD} \   ${grubby} --add-kernel=${kernelImage} ${INITRD} \
278   --copy-default ${makedefault} --title ${version} \   --copy-default ${makedefault} --title ${version} \
279   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
280   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${version}" \   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${version}" \
# Line 286  install() Line 298  install()
298   then   then
299   [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "adding ${version} to ${extlinuxConfig}"
300    
  if [[ -n ${banner} ]]  
  then  
  title="${banner} [ ${version} ]"  
  elif [ -f /etc/mageversion ]  
  then  
  title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"  
  else  
  title="Magellan Linux [ ${version} ]"  
  fi  
301   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
302   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${kernelImage} \
303   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
304   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \
305   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"   --args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}"
# Line 311  remove() Line 314  remove()
314   if [ -d /proc/iSeries ]   if [ -d /proc/iSeries ]
315   then   then
316   [[ -n ${verbose} ]] && echo "On an iSeries, remove img file"   [[ -n ${verbose} ]] && echo "On an iSeries, remove img file"
317   rm -f ${bootPrefix}/${kernelName}-${version}.img 2>/dev/null   rm -f ${kernelImage}.img 2>/dev/null
318   return   return
319   fi   fi
320    
# Line 319  remove() Line 322  remove()
322   then   then
323   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}"
324   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
325   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
326   else   else
327   [[ -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"
328   fi   fi
# Line 327  remove() Line 330  remove()
330   then   then
331   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}"
332   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
333   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
334   else   else
335   [[ -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"
336   fi   fi
337   if [[ -n ${cfgGrub2Efi} ]]   if [[ -n ${cfgGrub2Efi} ]]
338   then   then
339   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"
340   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
341   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
342   else   else
343   [[ -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"
344   fi   fi
# Line 343  remove() Line 346  remove()
346   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
347   then   then
348   [[ -n ${verbose} ]] && echo "removing ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${liloConfig}"
349   ${grubby} --remove-kernel=${bootPrefix}/${kernelName}-${version} --${liloFlag}   ${grubby} --remove-kernel=${kernelImage} --${liloFlag}
350    
351   if [[ -n ${runLilo} ]]   if [[ -n ${runLilo} ]]
352   then   then
# Line 367  remove() Line 370  remove()
370   then   then
371   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)
372   curversion=$(tail -n1 ${ubootDir}/${ubootKList})   curversion=$(tail -n1 ${ubootDir}/${ubootKList})
373   sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList}   sed "/$version$/d" ${ubootDir}/${ubootKList} > ${tmpKList}
374   newversion=$(tail -n1 ${tmpKList})   newversion=$(tail -n1 ${tmpKList})
375   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]
376   then   then
# Line 402  remove() Line 405  remove()
405   fi   fi
406    
407   mv ${tmpKList} ${ubootDir}/${ubootKList}   mv ${tmpKList} ${ubootDir}/${ubootKList}
408     [ -x /sbin/a-b-c ] && /sbin/a-b-c
409   else   else
410   [[ -n ${verbose} ]] && echo "uImage ${newversion} does not exist!"   [[ -n ${verbose} ]] && echo "uImage ${newversion} does not exist!"
411   [ -f ${tmpKList} ] && rm -f ${tmpKList}   [ -f ${tmpKList} ] && rm -f ${tmpKList}
# Line 417  remove() Line 421  remove()
421   then   then
422   [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${extlinuxConfig}"
423   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
424   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${kernelImage}
425   else   else
426   [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"   [[ -n ${verbose} ]] && echo "${extlinuxConfig} does not exist, not running grubby for extlinux"
427   fi   fi
# Line 425  remove() Line 429  remove()
429    
430  update()  update()
431  {  {
432   if [ ! -f ${bootPrefix}/${kernelName}-${version} ]   if [ ! -f ${kernelImage} ]
433   then   then
434   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby"
435   return   return
# Line 447  update() Line 451  update()
451   then   then
452   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}"
453   ${grubby} --grub -c ${grubConfig} \   ${grubby} --grub -c ${grubConfig} \
454   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
455   ${INITRD} \   ${INITRD} \
456   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
457   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"} \
458     ${mbkernel:+--add-multiboot="${mbkernel}"}
459   else   else
460   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"   [[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby"
461   fi   fi
# Line 459  update() Line 464  update()
464   then   then
465   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}"
466   ${grubby} --grub2 -c ${grub2Config} \   ${grubby} --grub2 -c ${grub2Config} \
467   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
468   ${INITRD} \   ${INITRD} \
469   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
470   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 470  update() Line 475  update()
475   if [[ -n ${cfgGrub2Efi} ]]   if [[ -n ${cfgGrub2Efi} ]]
476   then   then
477   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"
478   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
479   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
480   ${INITRD} \   ${INITRD} \
481   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
482   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 482  update() Line 487  update()
487   if [[ -n ${cfgLilo} ]]   if [[ -n ${cfgLilo} ]]
488   then   then
489   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}"
490   ${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \   ${grubby} --update-kernel=${kernelImage} \
491   ${INITRD} \   ${INITRD} \
492   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
493   ${removeargs:+--remove-args="${removeargs}"} \   ${removeargs:+--remove-args="${removeargs}"} \
# Line 509  update() Line 514  update()
514   [[ -n ${verbose} ]] && echo "creating uImage-${version}"   [[ -n ${verbose} ]] && echo "creating uImage-${version}"
515   mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \   mkimage -A arm -O linux -T kernel -C none -a ${ubootAddress} \
516   -e ${ubootAddress} -n ${version} \   -e ${ubootAddress} -n ${version} \
517   -d ${bootPrefix}/${kernelName}-${version} ${ubootDir}/uImage-${version}   -d ${kernelImage} ${ubootDir}/uImage-${version}
518    
519   [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"   [[ -n ${verbose} ]] && echo "creating uInitrd-${version}"
520   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 533  update()
533   [[ -n ${verbose} ]] && echo "copy uInitrd-${version} error, kernel not installed!" && exit   [[ -n ${verbose} ]] && echo "copy uInitrd-${version} error, kernel not installed!" && exit
534   fi   fi
535   echo ${version} >> ${ubootDir}/${ubootKList}   echo ${version} >> ${ubootDir}/${ubootKList}
536     [ -x /sbin/a-b-c ] && /sbin/a-b-c
537   else   else
538   [[ -n ${verbose} ]] && echo "cannot make ${version} the default"   [[ -n ${verbose} ]] && echo "cannot make ${version} the default"
539   fi   fi
# Line 539  update() Line 545  update()
545   then   then
546   [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${extlinuxConfig}"
547   ${grubby} --extlinux -c ${extlinuxConfig} \   ${grubby} --extlinux -c ${extlinuxConfig} \
548   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${kernelImage} \
549   ${INITRD} \   ${INITRD} \
550   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
551   ${removeargs:+--remove-args="${removeargs}"}   ${removeargs:+--remove-args="${removeargs}"}
# Line 581  doDepmod() Line 587  doDepmod()
587  doRmmoddep()  doRmmoddep()
588  {  {
589   [[ -n ${verbose} ]] && echo "removing modules.dep info for ${version}"   [[ -n ${verbose} ]] && echo "removing modules.dep info for ${version}"
590   [ -d /lib/modules/${version} ] && rm -f /lib/modules/${version}/modules.*   if [ -d /lib/modules/${version} ]
591     then
592     rm -f /lib/modules/${version}/modules.*.bin \
593     /lib/modules/${version}/modules.{alias,dep,devname,symbols,softdep}
594     fi
595  }  }
596    
597    
# Line 605  do Line 615  do
615   ;;   ;;
616    
617   --initrdfile*)   --initrdfile*)
618   if echo $1 | grep '=' >/dev/null   if [[ $1 == --initrdfile\=* ]]
619   then   then
620   initrdfile=$(echo $1 | sed 's/^--initrdfile=//')   initrdfile=${1#--initrdfile=}
621   else   else
622   initrdfile=$2   initrdfile=$2
623   shift   shift
# Line 615  do Line 625  do
625   ;;   ;;
626    
627   --kernel-args*)   --kernel-args*)
628   if echo $1 | grep '=' >/dev/null   if [[ $1 == --kernel-args\=* ]]
629   then   then
630   kernargs=$(echo $1 | sed 's/^--kernel-args=//')   kernargs=${1#--kernel-args=}
631   else   else
632   kernargs=$2   kernargs=$2
633   shift   shift
# Line 625  do Line 635  do
635   ;;   ;;
636    
637   --remove-args*)   --remove-args*)
638   if echo $1 | grep '=' >/dev/null   if [[ $1 == --remove-args\=* ]]
639   then   then
640   removeargs=$(echo $1 | sed 's/^--remove-args=//')   removeargs=${1#--remove-args=}
641   else   else
642   removeargs=$2   removeargs=$2
643   shift   shift
# Line 635  do Line 645  do
645   ;;   ;;
646    
647   --banner*)   --banner*)
648   if echo $1 | grep '=' >/dev/null   if [[ $1 == --banner\=* ]]
649   then   then
650   banner=$(echo $1 | sed 's/^--banner=//')   banner=${1#--banner=}
651   else   else
652   banner=$2   banner=$2
653   shift   shift
# Line 645  do Line 655  do
655   ;;   ;;
656    
657   --multiboot*)   --multiboot*)
658   if echo $1 |grep '=' >/dev/null   if [[ $1 == --multiboot\=* ]]
659   then   then
660   mbkernel=$(echo $1 | sed 's/^--multiboot=//')   mbkernel=${1#--multiboot=}
661   else   else
662   # can't really support having an optional second arg here   # can't really support having an optional second arg here
663   # sorry!   # sorry!
# Line 656  do Line 666  do
666   ;;   ;;
667    
668   --mbargs*)   --mbargs*)
669   if echo $1 |grep '=' >/dev/null   if [[ $1 == --mbargs\=* ]]
670   then   then
671   mbargs=$(echo $1 | sed 's/^--mbargs=//')   mbargs=${1#--mbargs=}
672   else   else
673   mbargs="$2"   mbargs="$2"
674   shift   shift
# Line 677  do Line 687  do
687   makedefault="--make-default"   makedefault="--make-default"
688   ;;   ;;
689    
690   --package)   --package*)
691   if echo $1 | grep '=' >/dev/null   if [[ $1 == --package\=* ]]
692   then   then
693   package=$(echo $1 | sed 's/^--package=//')   package=${1#--package=}
694   else   else
695   package=$2   package=$2
696   shift   shift
# Line 695  do Line 705  do
705   addplymouthinitrd=--add-plymouth-initrd   addplymouthinitrd=--add-plymouth-initrd
706   ;;   ;;
707    
708     --kernel-image*)
709     if [[ $1 == --kernel-image\=* ]]
710     then
711     kernelImage=${1#--kernel-image=}
712     else
713     kernelImage="$2"
714     shift
715     fi
716     if ! [[ -f ${kernelImage} ]]
717     then
718     echo "Can't find kernel image '${kernelImage}'" >&2
719     usage
720     exit 1
721     fi
722     ;;
723    
724   -v)   -v)
725   verbose=-v   verbose=-v
726   ;;   ;;
# Line 742  then Line 768  then
768   fi   fi
769  fi  fi
770    
771    [[ ${kernelImage} ]] || kernelImage="${bootPrefix}/${kernelName}-${version}"
772    
773  # 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
774  if [[ -z ${initrdfile} ]]  if [[ -z ${initrdfile} ]]
775  then  then
# Line 763  fi Line 791  fi
791  # add dracut i18n, keyboard and plymouth kernel args if requested  # add dracut i18n, keyboard and plymouth kernel args if requested
792  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]
793  then  then
794   [ -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} ]]  
795   then   then
796   kernargs="${kernargs} KEYTABLE=${KEYMAP}"   . /etc/vconsole.conf
797    
798     for i in SYSFONT SYSFONTACM UNIMAP KEYTABLE
799     do
800     val=$(eval echo \$$i)
801     [[ -n ${val} ]] && kernargs="${kernargs} ${i}=${val}"
802     done
803     else
804     if [ -r /etc/conf.d/consolefont ]
805     then
806     . /etc/conf.d/consolefont
807    
808     if [[ -n ${CONSOLEFONT} ]]
809     then
810     kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"
811     fi
812     fi
813    
814     if  [ -r /etc/conf.d/keymap ]
815     then
816     . /etc/conf.d/keymap
817    
818     if [[ -n ${KEYMAP} ]]
819     then
820     kernargs="${kernargs} KEYTABLE=${KEYMAP}"
821     fi
822     fi
823   fi   fi
824    
825   if [[ -n ${CONSOLEFONT} ]]   if [ -r /etc/locale.conf ]
826   then   then
827   kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"   . /etc/locale.conf
828    
829     if [[ -n ${LANG} ]]
830     then
831     kernargs="${kernargs} LANG=${LANG}"
832     fi
833   fi   fi
834  fi  fi
835    
# Line 831  then Line 887  then
887   fi   fi
888  fi  fi
889    
890    # if we're using U-Boot, check if the default load address should change
891    if [[ -n ${cfguBoot} ]] && [[ -z ${UBOOT_IMGADDR} ]]
892    then
893     [[ ${version}  =~ .([^.]*)$ ]]
894     platform=${BASH_REMATCH[1]}
895     # A few platforms use an alternate kernel load address
896     if [[ ${platform} = omap ]]
897     then
898     ubootAddress=0x80008000
899     elif [[ ${platform} = imx ]]
900     then
901     ubootAddress=0x90008000
902     fi
903    fi
904    
905  # 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
906  # is lilo to determine if it should be run  # is lilo to determine if it should be run
907  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]

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