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 2238 by niro, Mon Oct 21 13:22:57 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 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"}   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=""
  if [[ ${machine} == "OMAP3 Beagle Board" ]] || [[ ${machine} == "OMAP4 Panda board" ]]  
  then  
  ubootAddress=0x80008000  
  else  
  ubootAddress=0x00008000  
  fi  
129  else  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
# Line 184  install() Line 205  install()
205   fi   fi
206    
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 202  install() Line 227  install()
227   elif [ -f /etc/mageversion ]   elif [ -f /etc/mageversion ]
228   then   then
229   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
230     elif [[ $(read_os_release id) = magellan ]]
231     then
232     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
233   else   else
234   title="Magellan Linux [ ${version} ]"   title="Magellan Linux [ ${version} ]"
235   fi   fi
# Line 223  install() Line 251  install()
251   elif [ -f /etc/mageversion ]   elif [ -f /etc/mageversion ]
252   then   then
253   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
254     elif [[ $(read_os_release id) = magellan ]]
255     then
256     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
257   else   else
258   title="Magellan Linux [ ${version} ]"   title="Magellan Linux [ ${version} ]"
259   fi   fi
# Line 245  install() Line 276  install()
276   elif [ -f /etc/mageversion ]   elif [ -f /etc/mageversion ]
277   then   then
278   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
279     elif [[ $(read_os_release id) = magellan ]]
280     then
281     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
282   else   else
283   title="Magellan Linux [ ${version} ]"   title="Magellan Linux [ ${version} ]"
284   fi   fi
285   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
286   --add-kernel=${bootPrefix}/${kernelName}-${version} \   --add-kernel=${bootPrefix}/${kernelName}-${version} \
287   ${INITRD} --copy-default ${makedefault} --title "${title}" \   ${INITRD} --copy-default ${makedefault} --title "${title}" \
288   ${mbkernel:+--add-multiboot="${mbkernel}"} \   ${mbkernel:+--add-multiboot="${mbkernel}"} \
# Line 292  install() Line 326  install()
326   elif [ -f /etc/mageversion ]   elif [ -f /etc/mageversion ]
327   then   then
328   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"   title="Magellan Linux $(< /etc/mageversion) [ ${version} ]"
329     elif [[ $(read_os_release id) = magellan ]]
330     then
331     title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]"
332   else   else
333   title="Magellan Linux [ ${version} ]"   title="Magellan Linux [ ${version} ]"
334   fi   fi
# Line 334  remove() Line 371  remove()
371   if [[ -n ${cfgGrub2Efi} ]]   if [[ -n ${cfgGrub2Efi} ]]
372   then   then
373   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}"
374   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
375   --remove-kernel=${bootPrefix}/${kernelName}-${version}   --remove-kernel=${bootPrefix}/${kernelName}-${version}
376   else   else
377   [[ -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"
# Line 367  remove() Line 404  remove()
404   then   then
405   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)   tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX)
406   curversion=$(tail -n1 ${ubootDir}/${ubootKList})   curversion=$(tail -n1 ${ubootDir}/${ubootKList})
407   sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList}   sed "/$version$/d" ${ubootDir}/${ubootKList} > ${tmpKList}
408   newversion=$(tail -n1 ${tmpKList})   newversion=$(tail -n1 ${tmpKList})
409   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]   if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ]
410   then   then
# Line 470  update() Line 507  update()
507   if [[ -n ${cfgGrub2Efi} ]]   if [[ -n ${cfgGrub2Efi} ]]
508   then   then
509   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"   [[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}"
510   ${grubby} --grub2 -c ${grub2EfiConfig} \   ${grubby} --grub2 -c ${grub2EfiConfig} --efi \
511   --update-kernel=${bootPrefix}/${kernelName}-${version} \   --update-kernel=${bootPrefix}/${kernelName}-${version} \
512   ${INITRD} \   ${INITRD} \
513   ${kernargs:+--args="${kernargs}"} \   ${kernargs:+--args="${kernargs}"} \
# Line 763  fi Line 800  fi
800  # add dracut i18n, keyboard and plymouth kernel args if requested  # add dracut i18n, keyboard and plymouth kernel args if requested
801  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]  if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]]
802  then  then
803   [ -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} ]]  
804   then   then
805   kernargs="${kernargs} KEYTABLE=${KEYMAP}"   . /etc/vconsole.conf
806    
807     for i in SYSFONT SYSFONTACM UNIMAP KEYTABLE
808     do
809     val=$(eval echo \$$i)
810     [[ -n ${val} ]] && kernargs="${kernargs} ${i}=${val}"
811     done
812     else
813     if [ -r /etc/conf.d/consolefont ]
814     then
815     . /etc/conf.d/consolefont
816    
817     if [[ -n ${CONSOLEFONT} ]]
818     then
819     kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"
820     fi
821     fi
822    
823     if  [ -r /etc/conf.d/keymap ]
824     then
825     . /etc/conf.d/keymap
826    
827     if [[ -n ${KEYMAP} ]]
828     then
829     kernargs="${kernargs} KEYTABLE=${KEYMAP}"
830     fi
831     fi
832   fi   fi
833    
834   if [[ -n ${CONSOLEFONT} ]]   if [ -r /etc/locale.conf ]
835   then   then
836   kernargs="${kernargs} SYSFONT=${CONSOLEFONT}"   . /etc/locale.conf
837    
838     if [[ -n ${LANG} ]]
839     then
840     kernargs="${kernargs} LANG=${LANG}"
841     fi
842   fi   fi
843  fi  fi
844    
# Line 831  then Line 896  then
896   fi   fi
897  fi  fi
898    
899    # if we're using U-Boot, check if the default load address should change
900    if [[ -n ${cfguBoot} ]] && [[ -z ${UBOOT_IMGADDR} ]]
901    then
902     [[ ${version}  =~ .([^.]*)$ ]]
903     platform=${BASH_REMATCH[1]}
904     # A few platforms use an alternate kernel load address
905     if [[ ${platform} = omap ]]
906     then
907     ubootAddress=0x80008000
908     elif [[ ${platform} = imx ]]
909     then
910     ubootAddress=0x90008000
911     fi
912    fi
913    
914  # 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
915  # is lilo to determine if it should be run  # is lilo to determine if it should be run
916  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]  if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]]

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