Commit a09620c7 authored by Adam Wujek's avatar Adam Wujek 💬

rootfs: improve verification of downloaded dot-config

Try to source in the subshell downloaded dot-config.
This test can detect problems like unterminated quoted string:
/bin/sh: /tmp/dot-config: line 59: syntax error: unterminated quoted string
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 80663297
......@@ -107,9 +107,11 @@ if [ "$CONFIG_DOTCONF_SOURCE_REMOTE" = "y" ] || [ "$CONFIG_DOTCONF_SOURCE_TRY_DH
;;
esac
if [ -f $tmpconfig ]; then
# If it exists, it is not empty or too small, and the checker is happy
# If it exists, it is not empty or too small and the checker is happy
# then try to source it in another shell to verify syntax
if [ $(cat $tmpconfig | wc -c) -gt 200 ] &&
/wr/bin/wrs_checkcfg $tmpconfig /wr/etc/Kconfig; then
/wr/bin/wrs_checkcfg $tmpconfig /wr/etc/Kconfig &&
/bin/sh -c "source $tmpconfig"; then
echo "Using newly-downloaded dot-config from $URL" >& 2
# copy it in place to use the new file (unless it is identical)
cmp -s $tmpconfig $dotconfig || cp $tmpconfig $dotconfig
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment