Group :: Sistema/Kernel e hardware
RPM: grub
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: grub-2.04-os-alt.patch
Download
Download
diff --git a/grub/util/grub.d/10_linux.in b/grub/util/grub.d/10_linux.in
index 4532266be..cd87856f5 100644
--- a/grub/util/grub.d/10_linux.in
+++ b/grub/util/grub.d/10_linux.in
@@ -28,11 +28,10 @@ export TEXTDOMAINDIR="@localedir@"
CLASS="--class gnu-linux --class gnu --class os"
-if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
- OS=GNU/Linux
+if [ -r /etc/altlinux-release ]; then
+ OS=`cat /etc/altlinux-release | sed 's/ (.*$//g' | sed "s, $,,"`
else
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
+ OS="ALTLinux"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
@@ -52,8 +51,8 @@ GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true}
if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] ) \
|| ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
&& [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \
- || ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
- && ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \
+ || ( ! findfs UUID="${GRUB_DEVICE_UUID}" > /dev/null 2>&1 \
+ && ! findfs PARTUUID="${GRUB_DEVICE_PARTUUID}" > /dev/null 2>&1 ) \
|| ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \
@@ -58,6 +58,7 @@ case x"$GRUB_FS" in
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
if [ "x${rootsubvol}" != x ]; then
+ GRUB_CMDLINE_LINUX_DEFAULT="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX_DEFAULT}"
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
fi;;
xzfs)
@@ -92,9 +91,9 @@ linux_entry ()
if [ x$type != xsimple ] ; then
case $type in
recovery)
- title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;;
+ title="$(gettext_printf "%s, %s (recovery mode)" "${os}" "${version}")" ;;
*)
- title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;;
+ title="$(gettext_printf "%s, %s" "${os}" "${version}")" ;;
esac
if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
@@ -164,12 +163,12 @@ machine=`uname -m`
case "x$machine" in
xi?86 | xx86_64)
list=
- for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
+ for i in `ls -t1 /boot/vmlinuz /boot/vmlinu[z]-*`; do
if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
done ;;
*)
list=
- for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
+ for i in `ls -t1 /boot/vmlinuz /boot/vmlinu[xz]-*` ; do
if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
done ;;
esac
@@ -182,6 +181,9 @@ case "$machine" in
*) GENKERNEL_ARCH="$machine" ;;
esac
+[ ! -z "$GRUB_VMLINUZ_SYMLINKS" ] || GRUB_VMLINUZ_SYMLINKS="yes"
+[ ! -z "$GRUB_VMLINUZ_FAILSAFE" ] || GRUB_VMLINUZ_FAILSAFE="default"
+
prepare_boot_cache=
prepare_root_cache=
boot_device_id=
@@ -193,7 +195,7 @@ submenu_indentation=""
is_top_level=true
while [ "x$list" != "x" ] ; do
- linux=`version_find_latest $list`
+ linux=`echo $list | sed 's, .*,,g'`
gettext_printf "Found linux image: %s\n" "$linux" >&2
basename=`basename $linux`
dirname=`dirname $linux`
@@ -202,6 +204,20 @@ while [ "x$list" != "x" ] ; do
alt_version=`echo $version | sed -e "s,\.old$,,g"`
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
+ if [ -L "$linux" ]; then
+ if [ "x$GRUB_VMLINUZ_SYMLINKS" = "xno" ] || [ "x$GRUB_VMLINUZ_SYMLINKS" = "xfalse" ]; then
+ echo "skipping symlink: $linux" >&2
+ list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
+ continue
+ fi
+ if [ "$linux" != "/boot/vmlinuz" ] && [ "x$GRUB_VMLINUZ_SYMLINKS" = "xvmlinuz" ]; then
+ echo "skipping symlink: $linux" >&2
+ list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
+ continue
+ fi
+ fi
+
+
initrd_early=
for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \
${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do
@@ -211,19 +227,23 @@ while [ "x$list" != "x" ] ; do
done
initrd_real=
- for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \
- "initrd-${version}" "initramfs-${version}.img" \
- "initrd.img-${alt_version}" "initrd-${alt_version}.img" \
- "initrd-${alt_version}" "initramfs-${alt_version}.img" \
- "initramfs-genkernel-${version}" \
- "initramfs-genkernel-${alt_version}" \
- "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
- "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
+ default=false
+ linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
+ rel_dirname=`make_system_path_relative_to_its_root $dirname`
+ if [ x$linux != x/boot/vmlinuz ]; then
+ version=`echo $basename | sed -e "s,^vmlinuz-,,g"`
+ for i in "initrd-${version}.img" "initramfs-${version}.img"; do
if test -e "${dirname}/${i}" ; then
initrd_real="${i}"
break
fi
done
+ else
+ if [ -e /boot/initrd.img ]; then
+ initrd_real="initrd.img"
+ fi
+ default=true
+ fi
initrd=
if test -n "${initrd_early}" || test -n "${initrd_real}"; then
@@ -237,12 +257,14 @@ while [ "x$list" != "x" ] ; do
fi
config=
- for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
- if test -e "${i}" ; then
- config="${i}"
- break
- fi
- done
+ if [ x$linux != x/boot/vmlinuz ]; then
+ for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
+ if test -e "${i}" ; then
+ config="${i}"
+ break
+ fi
+ done
+ fi
initramfs=
if test -n "${config}" ; then
@@ -263,7 +285,7 @@ while [ "x$list" != "x" ] ; do
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
linux_entry "${OS}" "${version}" simple \
- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+ "${GRUB_CMDLINE_LINUX_DEFAULT}"
submenu_indentation="$grub_tab"
@@ -276,10 +298,12 @@ while [ "x$list" != "x" ] ; do
fi
linux_entry "${OS}" "${version}" advanced \
- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
- if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
- linux_entry "${OS}" "${version}" recovery \
- "single ${GRUB_CMDLINE_LINUX}"
+ "${GRUB_CMDLINE_LINUX_DEFAULT}" $default
+ if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ] && [ "x${GRUB_VMLINUZ_FAILSAFE}" != "xno" ] && [ "x${GRUB_VMLINUZ_FAILSAFE}" != "xfalse" ]; then
+ if [ $linux = "/boot/vmlinuz" ] || [ "x${GRUB_VMLINUZ_FAILSAFE}" != "xdefault" ]; then
+ linux_entry "${OS}" "${version}" recovery \
+ "${GRUB_CMDLINE_LINUX}" $default
+ fi
fi
list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`