From a3ff714c0d7787423f8505d89d503fa1e7edd4c3 Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Wed, 8 May 2013 18:56:29 +0200 Subject: [PATCH] mkproject: implement auto-update The script in the root directory needs to be in sync with the 'master' script in the 'meta-digi' layer. Signed-off-by: Javier Viguera --- sdk/mkproject.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sdk/mkproject.sh b/sdk/mkproject.sh index 9cac29b90..ccd27ee09 100755 --- a/sdk/mkproject.sh +++ b/sdk/mkproject.sh @@ -19,15 +19,6 @@ SCRIPTNAME="$(basename ${BASH_SOURCE})" SCRIPTPATH="$(cd $(dirname ${BASH_SOURCE}) && pwd)" PROJECTPATH="$(pwd)" -# if [ "${#}" -gt "0" ]; then -# echo $1 -# shift -# exec ${SCRIPTPATH}/${SCRIPTNAME} $@ -# fi -# Compare the script with the one in 'meta-digi'. If it differs, then -# copy-overwrite the one here and re-exec it after warning the user that the -# script was updated. - ## Color codes RED="\033[1;31m" GREEN="\033[1;32m" @@ -81,6 +72,15 @@ do_mkproject() { fi } +# Keep the running script in sync with the one in the layer. If it differs, +# update it (copy/overwrite) and warn the user. +if ! cmp -s ${SCRIPTPATH}/${SCRIPTNAME} ${SCRIPTPATH}/sources/meta-digi/sdk/${SCRIPTNAME}; then + install -m 0555 ${SCRIPTPATH}/sources/meta-digi/sdk/${SCRIPTNAME} ${SCRIPTPATH}/${SCRIPTNAME} + printf "\n${GREEN}[INFO]:${NONE} %s\n" "the '${SCRIPTNAME}' script has been updated." + printf "\nPlease run '. ${BASH_SOURCE}' again.\n\n" + return +fi + ## Get available platforms AVAILABLE_PLATFORMS="$(echo $(ls -1 ${CONFIGPATH}/*/local.conf.sample | sed -e 's,^.*config/\([^/]\+\)/local\.conf\.sample,\1,g'))"