mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-19 13:35:34 +08:00
135 lines
4.5 KiB
Diff
135 lines
4.5 KiB
Diff
diff -Nur a/util/grub.d/00_header.in b/util/grub.d/00_header.in
|
|
--- a/util/grub.d/00_header.in 2011-04-06 13:14:27.000000000 +0200
|
|
+++ b/util/grub.d/00_header.in 2011-04-26 09:23:02.371574484 +0200
|
|
@@ -100,6 +100,14 @@
|
|
|
|
EOF
|
|
|
|
+if [ x$GRUB_COLOR_NORMAL != x ] && [ x$GRUB_COLOR_HIGHLIGHT != x ] ; then
|
|
+ cat << EOF
|
|
+set menu_color_normal=$GRUB_COLOR_NORMAL
|
|
+set menu_color_highlight=$GRUB_COLOR_HIGHLIGHT
|
|
+
|
|
+EOF
|
|
+fi
|
|
+
|
|
serial=0;
|
|
gfxterm=0;
|
|
for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
|
|
diff -Nur a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
|
--- a/util/grub.d/10_linux.in 2011-04-18 23:18:49.000000000 +0200
|
|
+++ b/util/grub.d/10_linux.in 2011-04-26 10:16:54.397538449 +0200
|
|
@@ -48,7 +48,7 @@
|
|
|| uses_abstraction "${GRUB_DEVICE}" lvm; then
|
|
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
|
|
else
|
|
- LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
|
|
+ LINUX_ROOT_DEVICE="/dev/disk/by-uuid/${GRUB_DEVICE_UUID}"
|
|
fi
|
|
|
|
if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
|
|
@@ -65,7 +65,9 @@
|
|
version="$2"
|
|
recovery="$3"
|
|
args="$4"
|
|
- if ${recovery} ; then
|
|
+ if [ -n "$5" ] ; then
|
|
+ title="$(gettext_quoted "%s, with Linux %s") $5"
|
|
+ elif ${recovery} ; then
|
|
title="$(gettext_quoted "%s, with Linux %s (recovery mode)")"
|
|
else
|
|
title="$(gettext_quoted "%s, with Linux %s")"
|
|
@@ -121,11 +123,11 @@
|
|
|
|
case x`uname -m` in
|
|
xi?86 | xx86_64)
|
|
- list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
|
|
+ list=`for i in /boot/vmlinuz* /vmlinuz* /boot/kernel-* ; do
|
|
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
|
done` ;;
|
|
*)
|
|
- list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
|
|
+ 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
|
|
done` ;;
|
|
esac
|
|
@@ -148,7 +150,8 @@
|
|
"initrd.img-${alt_version}" "initrd-${alt_version}.img" \
|
|
"initrd-${alt_version}" "initramfs-${alt_version}.img" \
|
|
"initramfs-genkernel-${version}" \
|
|
- "initramfs-genkernel-${alt_version}"; do
|
|
+ "initramfs-genkernel-${alt_version}" \
|
|
+ "${basename/vmlinuz/kernel}.img"; do
|
|
if test -e "${dirname}/${i}" ; then
|
|
initrd="$i"
|
|
break
|
|
@@ -178,6 +181,11 @@
|
|
|
|
linux_entry "${OS}" "${version}" false \
|
|
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
|
+ if test -e "${dirname}/${basename/vmlinuz/kernel}-fallback.img"; then
|
|
+ initrd="${basename/vmlinuz/kernel}-fallback.img"
|
|
+ linux_entry "${OS}" "${version}" true \
|
|
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" Fallback
|
|
+ fi
|
|
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
|
|
linux_entry "${OS}" "${version}" true \
|
|
"single ${GRUB_CMDLINE_LINUX}"
|
|
diff -Nur a/util/grub-mkconfig.in b/util/grub-mkconfig.in
|
|
--- a/util/grub-mkconfig.in 2011-04-06 17:45:53.000000000 +0200
|
|
+++ b/util/grub-mkconfig.in 2011-04-26 09:23:02.371574484 +0200
|
|
@@ -33,6 +33,7 @@ datadir=@datadir@
|
|
pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
|
|
grub_cfg=""
|
|
grub_mkconfig_dir=${sysconfdir}/grub.d
|
|
+resume_hook=1
|
|
|
|
self=`basename $0`
|
|
|
|
@@ -52,6 +53,7 @@ Generate a grub config file
|
|
-o, --output=FILE output generated config to FILE [default=stdout]
|
|
-h, --help print this message and exit
|
|
-v, --version print the version information and exit
|
|
+ -s, --skip-resume disable resume hook setup
|
|
|
|
Report bugs to <bug-grub@gnu.org>.
|
|
EOF
|
|
@@ -86,6 +88,9 @@ do
|
|
--output=*)
|
|
grub_cfg=`echo "$option" | sed 's/--output=//'`
|
|
;;
|
|
+ -s | --skip-resume)
|
|
+ resume_hook=0
|
|
+ ;;
|
|
-*)
|
|
echo "Unrecognized option \`$option'" 1>&2
|
|
usage
|
|
@@ -252,6 +252,8 @@
|
|
GRUB_THEME \
|
|
GRUB_GFXPAYLOAD_LINUX \
|
|
GRUB_DISABLE_OS_PROBER \
|
|
+ GRUB_COLOR_NORMAL \
|
|
+ GRUB_COLOR_HIGHLIGHT \
|
|
GRUB_INIT_TUNE \
|
|
GRUB_SAVEDEFAULT \
|
|
GRUB_BADRAM
|
|
@@ -293,6 +298,18 @@ for i in ${grub_mkconfig_dir}/* ; do
|
|
esac
|
|
done
|
|
|
|
+if [ "${resume_hook}" == 1 ]; then
|
|
+ echo "Setup resume hook" >&2
|
|
+ SWAP=`swapon -a | cat /proc/swaps | grep /dev | cut -d" " -f1`
|
|
+ if [ -z "${SWAP}" ]; then
|
|
+ echo "No swap partition found. Create one to enable hibernation..." >&2
|
|
+ else
|
|
+ echo "Adding swap partition $SWAP" >&2
|
|
+ SWAPUUID=`blkid $SWAP -s UUID -o value`
|
|
+ sed -i -e "s~root=/dev~resume=/dev/disk/by-uuid/${SWAPUUID} root=/dev~g" ${grub_cfg}.new
|
|
+ fi
|
|
+fi
|
|
+
|
|
if test "x${grub_cfg}" != "x" ; then
|
|
if ! ${grub_script_check} ${grub_cfg}.new; then
|
|
echo "Syntax errors are detected in generated GRUB config file." >&2
|