]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
syntax check before overwriting
authorbvk.groups@gmail.com <>
Tue, 7 Sep 2010 05:48:53 +0000 (11:18 +0530)
committerbvk.groups@gmail.com <>
Tue, 7 Sep 2010 05:48:53 +0000 (11:18 +0530)
util/grub-mkconfig.in

index 828b54bce0b8e81e5c8e69559d3e449c36124eb8..3233043c8d87b050d45d3ffca22d8263062676a4 100644 (file)
@@ -314,8 +314,15 @@ for i in ${grub_mkconfig_dir}/* ; do
 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