sdk: mkproject: Generalize to use from custom layer.

Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
This commit is contained in:
Alex Gonzalez 2017-01-31 12:52:16 +01:00
parent 358961f2b1
commit d0f727afeb
1 changed files with 8 additions and 4 deletions

View File

@ -48,6 +48,7 @@ Usage: source ${MKP_SCRIPTNAME} [OPTIONS]
-l list supported platforms -l list supported platforms
-p <platform> select platform for the project -p <platform> select platform for the project
-m <layer> Layer with the supported platforms (defaults to meta-digi)
Supported platforms: $(display_supported_platforms) Supported platforms: $(display_supported_platforms)
@ -148,28 +149,31 @@ if ! cmp -s ${MKP_SCRIPTPATH}/${MKP_SCRIPTNAME} ${MKP_SCRIPTPATH}/sources/meta-d
return return
fi fi
## Get available platforms
MKP_AVAILABLE_PLATFORMS="$(echo $(ls -1 ${MKP_CONFIGPATH}/*/local.conf.sample | sed -e 's,^.*config/\([^/]\+\)/local\.conf\.sample,\1,g'))"
# Verify if this is a new project (so we do NOT customize it) # Verify if this is a new project (so we do NOT customize it)
[ -r "${MKP_PROJECTPATH}/conf/bblayers.conf" -a -r "${MKP_PROJECTPATH}/conf/local.conf" ] && MKP_OLD_PROJECT="1" [ -r "${MKP_PROJECTPATH}/conf/bblayers.conf" -a -r "${MKP_PROJECTPATH}/conf/local.conf" ] && MKP_OLD_PROJECT="1"
# The script needs to be sourced (not executed) so make sure to # The script needs to be sourced (not executed) so make sure to
# initialize OPTIND variable for getopts. # initialize OPTIND variable for getopts.
OPTIND=1 OPTIND=1
while getopts "lp:v:" c; do while getopts "lp:v:m:" c; do
case "${c}" in case "${c}" in
l) MKP_LIST_PLATFORMS="y";; l) MKP_LIST_PLATFORMS="y";;
p) MKP_PLATFORM="${OPTARG}";; p) MKP_PLATFORM="${OPTARG}";;
v) MKP_VARIANT="${OPTARG}";; v) MKP_VARIANT="${OPTARG}";;
m) MKP_CONFIGPATH="${MKP_SCRIPTPATH}/sources/${OPTARG}/sdk/config";;
esac esac
done done
## Get available platforms
MKP_AVAILABLE_PLATFORMS="$(echo $(ls -1 ${MKP_CONFIGPATH}/*/local.conf.sample | sed -e 's,^.*config/\([^/]\+\)/local\.conf\.sample,\1,g'))"
## Sanity checks ## Sanity checks
if [ "${BASH_SOURCE}" = "${0}" ]; then if [ "${BASH_SOURCE}" = "${0}" ]; then
error "This script needs to be sourced" error "This script needs to be sourced"
elif [ ${#} -eq 0 ] ; then elif [ ${#} -eq 0 ] ; then
usage usage
elif [ ! -d "${MKP_CONFIGPATH}" ]; then
error "selected platform configuration directory \"${MKP_CONFIGPATH}\" does not exist"
elif [ -n "${MKP_LIST_PLATFORMS}" ]; then elif [ -n "${MKP_LIST_PLATFORMS}" ]; then
display_supported_platforms display_supported_platforms
elif [ -z "${MKP_PLATFORM}" ]; then elif [ -z "${MKP_PLATFORM}" ]; then