Skip to content

Instantly share code, notes, and snippets.

@fstirlitz
Created November 25, 2013 10:05
Show Gist options
  • Save fstirlitz/7639129 to your computer and use it in GitHub Desktop.
Save fstirlitz/7639129 to your computer and use it in GitHub Desktop.
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index ba1d4ef..b5aa75e 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -212,6 +212,8 @@ export GRUB_DEFAULT \
GRUB_THEME \
GRUB_GFXPAYLOAD_LINUX \
GRUB_DISABLE_OS_PROBER \
+ GRUB_COLOR_NORMAL \
+ GRUB_COLOR_HIGHLIGHT \
GRUB_INIT_TUNE \
GRUB_SAVEDEFAULT \
GRUB_ENABLE_CRYPTODISK \
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index a9cf7fc..dac108c 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -245,6 +245,10 @@ version_test_gt ()
*.old:*.old) ;;
*.old:*) version_test_gt_a="`echo -n "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;;
*:*.old) version_test_gt_b="`echo -n "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;;
+
+ *-lts:*-lts) ;;
+ *-lts:*) version_test_gt_a="`echo -n "$version_test_gt_a" | sed -e 's/-lts$//'`" ; version_test_gt_cmp=gt ;;
+ *:*-lts) version_test_gt_b="`echo -n "$version_test_gt_b" | sed -e 's/-lts$//'`" ; version_test_gt_cmp=ge ;;
esac
version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b"
return "$?"
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 9838720..dbb5dd2 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -125,6 +125,14 @@ cat <<EOF
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 --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index e27d6f7..bf241cf 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -87,6 +87,8 @@ linux_entry ()
case $type in
recovery)
title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;;
+ fallback)
+ title="$(gettext_printf "%s, with Linux %s (Fallback initramfs)" "${os}" "${version}")" ;;
*)
title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;;
esac
@@ -100,7 +102,7 @@ linux_entry ()
else
echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
fi
- if [ x$type != xrecovery ] ; then
+ if [ x$type != xrecovery ] && [ x$type != xfallback ] ; then
save_default_entry | grub_add_tab
fi
@@ -132,7 +134,8 @@ linux_entry ()
fi
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
fi
- message="$(gettext_printf "Loading Linux %s ..." ${version})"
+
+ message="$(gettext_printf "Loading Linux %s ..." "${version}")"
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
@@ -190,7 +193,22 @@ while [ "x$list" != "x" ] ; do
alt_version=`echo $version | sed -e "s,\.old$,,g"`
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
+ if test -e "/etc/arch-release" ; then
+ if echo "${basename}" | grep -q 'vmlinuz-linux' ; then
+ version="`echo "${basename}" | sed -e 's,vmlinuz-linux,,g'`"
+
+ if [ "x${version}" = "x" ] ; then
+ version="core repo kernel"
+ else
+ version="`echo "${version}" | sed -e 's,-,,g'`"
+ version="${version} kernel"
+ fi
+ fi
+ fi
+
initrd=
+ initrd_arch="`echo "${basename}" | sed -e 's,vmlinuz,initramfs,g'`"
+
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" \
@@ -198,7 +216,8 @@ while [ "x$list" != "x" ] ; do
"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}" \
+ "${initrd_arch}.img" ; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
@@ -242,6 +261,18 @@ while [ "x$list" != "x" ] ; do
linux_entry "${OS}" "${version}" advanced \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+
+ if test -e "/etc/arch-release" ; then
+ for i in "${initrd_arch}-fallback.img" "initramfs-${version}-fallback.img" ; do
+ if test -e "${dirname}/${i}" ; then
+ initrd="${i}"
+ linux_entry "${OS}" "${version}" fallback \
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+ break
+ fi
+ done
+ fi
+
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}" "${version}" recovery \
"single ${GRUB_CMDLINE_LINUX}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment