* util/grub-mkconfig.in: Check the config script for syntax errors

before saving.
This commit is contained in:
BVK Chaitanya 2010-09-19 08:49:25 +05:30
commit 2f4e8053e0
2 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2010-09-19 BVK Chaitanya <bvk.groups@gmail.com>
* util/grub-mkconfig.in: Check the config script for syntax errors
before saving.
2010-09-19 Colin Watson <cjwatson@ubuntu.com>
2010-09-19 Vladimir Serbinenko <phcoder@gmail.com>

View File

@ -305,8 +305,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; 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