Hi,

Attached patch adds long pending feature:  Use grub-script-check tool
to detect any syntax errors in generated config files (by
grub-mkconfig) before copying it to the destination.




bvk.chaitanya
=== modified file 'util/grub-mkconfig.in'
--- util/grub-mkconfig.in	2010-06-29 15:20:49 +0000
+++ util/grub-mkconfig.in	2010-09-07 05:44:47 +0000
@@ -314,8 +314,15 @@
 done
 
 if test "x${grub_cfg}" != "x" ; then
-  # none of the children aborted with error, install the new grub.cfg
-  mv -f ${grub_cfg}.new ${grub_cfg}
+  if ! grub-script-check ${grub_cfg}.new 2>/dev/null; then
+    echo "Syntax errors are detected in generated GRUB config file." >&2
+    echo "Ensure that there are no errors in /etc/default/grub" >&2
+    echo "and /etc/grub.d/* files or please file a bug report with" >&2
+    echo "${grub_cfg}.new file attached." >&2
+  else
+    # none of the children aborted with error, install the new grub.cfg
+    mv -f ${grub_cfg}.new ${grub_cfg}
+  fi
 fi
 
 echo "done" >&2

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to