You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-overlay/profiles/templates/3.6/6_ac_install_patch/sys-boot/grub/2.00/grub2-chroot.patch

148 lines
6.4 KiB

# Calculate format=diff merge(sys-boot/grub)>=2.00
Add CHROOT_PATH ability. Add sync before grub_setup.
diff --git util/grub-install.in util/grub-install.in
index e19f1cd..aa978c8 100644
--- util/grub-install.in
+++ util/grub-install.in
@@ -737,6 +737,8 @@ fi
# Perform the grub_modinfo_platform-dependent install
if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "sparc64-ieee1275" ] ; then
+ # sync filesystem before grub_setup
+ sync
# Now perform the installation.
"$grub_setup" ${allow_floppy} ${setup_verbose} ${setup_force} --directory="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform" \
--device-map="${device_map}" "${install_device}" || exit 1
diff --git util/grub-mkconfig.in util/grub-mkconfig.in
index 516be86..9f19817 100644
--- util/grub-mkconfig.in
+++ util/grub-mkconfig.in
@@ -129,19 +129,19 @@ else
fi
# Device containing our userland. Typically used for root= parameter.
-GRUB_DEVICE="`${grub_probe} --target=device /`"
+GRUB_DEVICE="`${grub_probe} --target=device /${CHROOT_PATH#/}`"
GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
# Device containing our /boot partition. Usually the same as GRUB_DEVICE.
-GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
+GRUB_DEVICE_BOOT="`${grub_probe} --target=device ${CHROOT_PATH%/}/boot`"
GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
# Filesystem for the device containing our userland. Used for stuff like
# choosing Hurd filesystem module.
GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`"
-if test -f ${sysconfdir}/default/grub ; then
- . ${sysconfdir}/default/grub
+if test -f ${CHROOT_PATH}${sysconfdir}/default/grub ; then
+ . ${CHROOT_PATH}${sysconfdir}/default/grub
fi
# XXX: should this be deprecated at some point?
diff --git util/grub.d/00_header.in util/grub.d/00_header.in
index 765bfdc..2622638 100644
--- util/grub.d/00_header.in
+++ util/grub.d/00_header.in
@@ -137,7 +137,7 @@ fi
if [ "x$gfxterm" = x1 ]; then
if [ -n "$GRUB_FONT" ] ; then
# Make the font accessible
- prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT}"`
+ prepare_grub_to_access_device `${grub_probe} --target=device "${CHROOT_PATH%/}${GRUB_FONT}"`
cat << EOF
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT}"` ; then
EOF
@@ -160,7 +160,7 @@ if [ x\$feature_default_font_path = xy ] ; then
else
EOF
# Make the font accessible
- prepare_grub_to_access_device `${grub_probe} --target=device "${font_path}"`
+ prepare_grub_to_access_device `${grub_probe} --target=device "${CHROOT_PATH%/}${font_path}"`
cat << EOF
font="`make_system_path_relative_to_its_root "${font_path}"`"
fi
@@ -221,7 +221,7 @@ if [ "x$gfxterm" = x1 ]; then
&& is_path_readable_by_grub "$GRUB_THEME"; then
gettext_printf "Found theme: %s\n" "$GRUB_THEME" >&2
- prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"`
+ prepare_grub_to_access_device `${grub_probe} --target=device "${CHROOT_PATH%/}$GRUB_THEME"`
cat << EOF
insmod gfxmenu
EOF
@@ -253,8 +253,8 @@ EOF
set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
export theme
EOF
- elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \
- && is_path_readable_by_grub "$GRUB_BACKGROUND"; then
+ elif [ "x${CHROOT_PATH}$GRUB_BACKGROUND" != x ] && [ -f "${CHROOT_PATH%/}$GRUB_BACKGROUND" ] \
+ && is_path_readable_by_grub "${CHROOT_PATH%/}$GRUB_BACKGROUND"; then
gettext_printf "Found background: %s\n" "$GRUB_BACKGROUND" >&2
case "$GRUB_BACKGROUND" in
*.png) reader=png ;;
@@ -262,7 +262,7 @@ EOF
*.jpg|*.jpeg) reader=jpeg ;;
*) gettext "Unsupported image format" >&2; echo >&2; exit 1 ;;
esac
- prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"`
+ prepare_grub_to_access_device `${grub_probe} --target=device "${CHROOT_PATH%/}$GRUB_BACKGROUND"`
cat << EOF
insmod $reader
background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
diff --git util/grub.d/10_linux.in util/grub.d/10_linux.in
index 14402e8..7cca45d 100644
--- util/grub.d/10_linux.in
+++ util/grub.d/10_linux.in
@@ -31,7 +31,7 @@ CLASS="--class gnu-linux --class gnu --class os"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
+ OS="${GRUB_DISTRIBUTOR}"
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
fi
@@ -153,12 +153,18 @@ EOF
machine=`uname -m`
case "x$machine" in
xi?86 | xx86_64)
- list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
- if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+ list=`for i in ${CHROOT_PATH%/}/boot/vmlinuz-* \
+ ${CHROOT_PATH%/}/vmlinuz-* \
+ ${CHROOT_PATH%/}/boot/kernel-* ; do
+ if grub_file_is_not_garbage "$i" && ! [[ -L $i ]] ; then echo -n "$i " ; fi
done` ;;
*)
- list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
- if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+ list=`for i in ${CHROOT_PATH%/}/boot/vmlinuz-* \
+ ${CHROOT_PATH%/}/boot/vmlinux-* \
+ ${CHROOT_PATH%/}/vmlinuz-* \
+ ${CHROOT_PATH%/}/vmlinux-* \
+ ${CHROOT_PATH%/}/boot/kernel-* ; do
+ if grub_file_is_not_garbage "$i" && ! [[ -L $i ]] ; then echo -n "$i " ; fi
done` ;;
esac
@@ -186,6 +192,7 @@ while [ "x$list" != "x" ] ; do
basename=`basename $linux`
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
+ rel_dirname=${rel_dirname#/workspace}
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
alt_version=`echo $version | sed -e "s,\.old$,,g"`
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
@@ -197,6 +204,8 @@ while [ "x$list" != "x" ] ; do
"initrd-${alt_version}" "initramfs-${alt_version}.img" \
"initramfs-genkernel-${version}" \
"initramfs-genkernel-${alt_version}" \
+ "initramfs-${version}" \
+ "initramfs-${version}-install" \
"initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
"initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
if test -e "${dirname}/${i}" ; then