diff --git a/buildroot/bin/build_example b/buildroot/bin/build_example index 7c075e700c8..b9be61dbf1c 100755 --- a/buildroot/bin/build_example +++ b/buildroot/bin/build_example @@ -4,7 +4,7 @@ # # build_example -b|--base= - Configurations root folder (e.g., ./.pio/build-BRANCH) # -c|--config= - Sub-path of the configs to build (within config/examples) -# [-e|--export=N] - Set CONFIG_EXPORT before build and export +# [-e|--export=N] - Use CONFIG_EXPORT N to export the config to the export location # [-a|--archive] - Archive the build (to the export location) # [-o|--output] - Redirect export / archiving to another location # (By default export to origin config folder) @@ -19,7 +19,7 @@ usage() { echo "Usage: build_example -b|--base= - Configurations root folder (e.g., ./.pio/build-BRANCH) -c|--config= - Sub-path of the configs to build (within config/examples) - [-e|--export=N] - Set CONFIG_EXPORT before build and export + [-e|--export=N] - Use CONFIG_EXPORT N to export the config to the export location [-a|--archive] - Archive the build (to the export location) [-o|--output] - Redirect export / archiving to another location (By default export to origin config folder) @@ -195,15 +195,19 @@ if ((ARCHIVE)); then rm -f "$ARCSUB"/*.bin.tar.gz "$ARCSUB"/*.hex.tar.gz find "$BUILD" \( "${BNAME[@]}" \) -exec sh -c ' ARCSUB="$1" - shift 1 - for file in "$@"; do - cd "$(dirname "$file")" - base=$(basename "$file") - tar -czf "$ARCSUB/$base.tar.gz" "$base" - rm "$base" + CONFIG="$2" + shift 2 + for FILE in "$@"; do + cd "${FILE%/*}" + BASE=${FILE##*/} + SHRT=${BASE%.*} + SHASUM=$(sha256sum "$BASE" | cut -d" " -f1) + tar -czf "$ARCSUB/$SHRT.tar.gz" "$BASE" + echo "$CONFIG\n$SHASUM" > "$ARCSUB/$BASE.sha256.txt" + rm "$BASE" cd - >/dev/null done - ' sh "$ARCSUB" {} + + ' sh "$ARCSUB" "$CONFIG" {} + fi # Exit with error unless --nofail is set