--- trunk/grubby/new-kernel-pkg 2012/03/03 15:22:47 1770 +++ trunk/grubby/new-kernel-pkg 2012/07/02 13:04:02 1847 @@ -25,6 +25,32 @@ # along with this program. If not, see . # +read_os_release() +{ + local NAME + local ID + local Version + local Version_ID + local PRETTY_NAME + local ANSI_COLOR + local CPE_NAME + + if [[ -f /etc/os-release ]] + then + source /etc/os-release + + case $1 in + name) echo "${NAME}" ;; + id) echo "${ID}" ;; + version) echo "${Version}" ;; + version_id) echo "${Version_ID}" ;; + pretty_name) echo "${PRETTY_NAME}" ;; + ansi_color) echo "${ANSI_COLOR}" ;; + cpe_name) echo "${CPE_NAME}" ;; + esac + fi +} + PATH=/sbin:/bin:$PATH lilo=/sbin/lilo @@ -65,6 +91,7 @@ elif [[ ${ARCH} = ppc64 ]] || [[ ${ARCH} = ppc ]] then liloConfig=/etc/yaboot.conf + grub2Config=/boot/grub/grub.cfg bootPrefix=/boot lilo=/sbin/ybin liloFlag=yaboot @@ -87,10 +114,9 @@ isx86="" elif [[ ${ARCH} = armv7l ]] || [[ ${ARCH} = armv7hl ]] || [[ ${ARCH} = armv5tel ]] then - machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//') liloConfig="" bootPrefix=/boot - ubootDir=${UBOOT_DIR:-"/boot/uboot"} + ubootDir=${UBOOT_DIR:-"/boot"} ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"} ubootKList=${UBOOT_KLIST:-"klist.txt"} ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"} @@ -99,11 +125,17 @@ mounted="" liloFlag="" isx86="" - if [[ ${machine} == "OMAP3 Beagle Board" ]] || [[ ${machine} == "OMAP4 Panda board" ]] + if [[ -z ${UBOOT_IMGADDR} ]] then - ubootAddress=0x80008000 + machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//') + if [ "${machine}" == "OMAP3 Beagle Board" ] || [ "${machine}" == "OMAP4 Panda board" ] + then + ubootAddress=0x80008000 + else + ubootAddress=0x00008000 + fi else - ubootAddress=0x00008000 + ubootAddress="${UBOOT_IMGADDR}" fi else # this leaves i?86 and x86_64 @@ -202,6 +234,9 @@ elif [ -f /etc/mageversion ] then title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" + elif [[ $(read_os_release id) = magellan ]] + then + title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]" else title="Magellan Linux [ ${version} ]" fi @@ -223,6 +258,9 @@ elif [ -f /etc/mageversion ] then title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" + elif [[ $(read_os_release id) = magellan ]] + then + title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]" else title="Magellan Linux [ ${version} ]" fi @@ -245,6 +283,9 @@ elif [ -f /etc/mageversion ] then title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" + elif [[ $(read_os_release id) = magellan ]] + then + title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]" else title="Magellan Linux [ ${version} ]" fi @@ -292,6 +333,9 @@ elif [ -f /etc/mageversion ] then title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" + elif [[ $(read_os_release id) = magellan ]] + then + title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]" else title="Magellan Linux [ ${version} ]" fi @@ -367,7 +411,7 @@ then tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX) curversion=$(tail -n1 ${ubootDir}/${ubootKList}) - sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList} + sed "/$version$/d" ${ubootDir}/${ubootKList} > ${tmpKList} newversion=$(tail -n1 ${tmpKList}) if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ] then