mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-11 18:54:37 +08:00
108 lines
3.7 KiB
Diff
108 lines
3.7 KiB
Diff
|
diff -Naur a/util/grub-mkconfig.in b/util/grub-mkconfig.in
|
||
|
--- a/util/grub-mkconfig.in 2012-07-15 04:23:47.048814588 +0200
|
||
|
+++ b/util/grub-mkconfig.in 2012-07-15 04:28:57.870930879 +0200
|
||
|
@@ -35,6 +35,7 @@
|
||
|
pkgdatadir="${datadir}/@PACKAGE@"
|
||
|
fi
|
||
|
grub_cfg=""
|
||
|
+resume_hook=1
|
||
|
grub_mkconfig_dir="${sysconfdir}"/grub.d
|
||
|
|
||
|
self=`basename $0`
|
||
|
@@ -57,6 +58,7 @@
|
||
|
print_option_help "-o, --output=$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")"
|
||
|
print_option_help "-h, --help" "$(gettext "print this message and exit")"
|
||
|
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
|
||
|
+ print_option_help "-s, --skip-resume" "$(gettext "disable resume hook setup")"
|
||
|
echo
|
||
|
gettext "Report bugs to <bug-grub@gnu.org>."; echo
|
||
|
}
|
||
|
@@ -90,6 +92,9 @@
|
||
|
--output=*)
|
||
|
grub_cfg=`echo "$option" | sed 's/--output=//'`
|
||
|
;;
|
||
|
+ -s | --skip-resume)
|
||
|
+ resume_hook=0
|
||
|
+ ;;
|
||
|
-*)
|
||
|
gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
|
||
|
usage
|
||
|
@@ -216,7 +221,9 @@
|
||
|
GRUB_INIT_TUNE \
|
||
|
GRUB_SAVEDEFAULT \
|
||
|
GRUB_ENABLE_CRYPTODISK \
|
||
|
- GRUB_BADRAM
|
||
|
+ GRUB_BADRAM \
|
||
|
+ GRUB_COLOR_NORMAL \
|
||
|
+ GRUB_COLOR_HIGHLIGHT
|
||
|
|
||
|
if test "x${grub_cfg}" != "x"; then
|
||
|
rm -f "${grub_cfg}.new"
|
||
|
@@ -253,6 +260,19 @@
|
||
|
esac
|
||
|
done
|
||
|
|
||
|
+if [ "${resume_hook}" == 1 ]; then
|
||
|
+ echo "Setup resume hook" >&2
|
||
|
+ SWAP="$(swapon -a | cat /proc/swaps | grep /dev | cut -d ' ' -f 1)"
|
||
|
+ 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 -e "s~root=/dev/~resume=/dev/disk/by-uuid/${SWAPUUID} root=/dev/~g" \
|
||
|
+ -i "${grub_cfg}.new"
|
||
|
+ fi
|
||
|
+fi
|
||
|
+
|
||
|
if test "x${grub_cfg}" != "x" ; then
|
||
|
if ! ${grub_script_check} ${grub_cfg}.new; then
|
||
|
# TRANSLATORS: %s is replaced by filename
|
||
|
diff -Naur a/util/grub.d/00_header.in b/util/grub.d/00_header.in
|
||
|
--- a/util/grub.d/00_header.in 2012-07-15 04:23:47.048814588 +0200
|
||
|
+++ b/util/grub.d/00_header.in 2012-07-15 04:24:03.873603848 +0200
|
||
|
@@ -115,6 +115,14 @@
|
||
|
|
||
|
EOF
|
||
|
|
||
|
+if [ -n "$GRUB_COLOR_NORMAL" ] && [ -n "$GRUB_COLOR_HIGHLIGHT" ] ; 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 -Naur a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||
|
--- a/util/grub.d/10_linux.in 2012-07-15 04:23:47.048814588 +0200
|
||
|
+++ b/util/grub.d/10_linux.in 2012-07-15 04:24:03.874603867 +0200
|
||
|
@@ -31,8 +31,8 @@
|
||
|
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||
|
OS=GNU/Linux
|
||
|
else
|
||
|
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
||
|
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
|
||
|
+ OS="${GRUB_DISTRIBUTOR} Linux"
|
||
|
+ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | tr -d ' ') ${CLASS}"
|
||
|
fi
|
||
|
|
||
|
# loop-AES arranges things so that /dev/loop/X can be our root device, but
|
||
|
@@ -195,10 +195,13 @@
|
||
|
"initrd-${version}" "initramfs-${version}.img" \
|
||
|
"initrd.img-${alt_version}" "initrd-${alt_version}.img" \
|
||
|
"initrd-${alt_version}" "initramfs-${alt_version}.img" \
|
||
|
+ "initramfs-linux-${version}" "initramfs-linux-${version}.img" \
|
||
|
+ "initramfs-linux-${alt_version}" "initramfs-linux-${alt_version}.img" \
|
||
|
"initramfs-genkernel-${version}" \
|
||
|
"initramfs-genkernel-${alt_version}" \
|
||
|
"initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
|
||
|
- "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
|
||
|
+ "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" \
|
||
|
+ "${basename/vmlinuz/kernel}.img"; do
|
||
|
if test -e "${dirname}/${i}" ; then
|
||
|
initrd="$i"
|
||
|
break
|