Commit 9dd2d834 authored by Alessandro Rubini's avatar Alessandro Rubini

boot scripts: check the downloaded dot-config before using it

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 89b04c5b
...@@ -34,6 +34,7 @@ cat > $TMPSCRIPT << EOF ...@@ -34,6 +34,7 @@ cat > $TMPSCRIPT << EOF
. $WRS_BASE_DIR/../.config . $WRS_BASE_DIR/../.config
mkdir -p $TMPFS/wr/etc mkdir -p $TMPFS/wr/etc
cp $WRS_BASE_DIR/../.config $TMPFS/wr/etc/dot-config cp $WRS_BASE_DIR/../.config $TMPFS/wr/etc/dot-config
cp $WRS_BASE_DIR/../Kconfig $TMPFS/wr/etc/Kconfig
cp -r $rootfs_vanilla/* $TMPFS cp -r $rootfs_vanilla/* $TMPFS
cp -r $WRS_OUTPUT_DIR/images/wr/* $TMPFS/wr cp -r $WRS_OUTPUT_DIR/images/wr/* $TMPFS/wr
......
...@@ -45,12 +45,14 @@ if [ -n "$CONFIG_DOTCONF_URL" ]; then ...@@ -45,12 +45,14 @@ if [ -n "$CONFIG_DOTCONF_URL" ]; then
echo "Invalid URL for dot-config: \"$URL\"" >& 2 echo "Invalid URL for dot-config: \"$URL\"" >& 2
;; ;;
esac esac
# If it exists and it is not empty or awfully small, trust it # If it exists, it is not empty or too small, and the checker is happy..
if [ -f $tmpconfig ] && if [ -f $tmpconfig ] &&
[ $(cat $tmpconfig | wc -c) -gt 200 ]; then [ $(cat $tmpconfig | wc -c) -gt 200 ] &&
/wr/bin/wrs_checkcfg $tmpconfig /wr/etc/Kconfig; then
# copy it in place to use the new file (unless it is identical)
cmp -s $tmpconfig $dotconfig || cp $tmpconfig $dotconfig cmp -s $tmpconfig $dotconfig || cp $tmpconfig $dotconfig
fi fi
fi fi
# Finally, apply what we have, be it old or new # Finally, apply what we have, be it old or new
. /wr/bin/apply_dot-config /wr/bin/apply_dot-config
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