1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 13:25:54 +00:00

🧑‍💻 Make sha256sum for archived binary

This commit is contained in:
Scott Lahteine 2024-09-18 10:33:19 -05:00
parent 4da46c5dd2
commit febfb3218e

View File

@ -4,7 +4,7 @@
#
# build_example -b|--base=<path> - Configurations root folder (e.g., ./.pio/build-BRANCH)
# -c|--config=<rel> - 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=<path> - Configurations root folder (e.g., ./.pio/build-BRANCH)
-c|--config=<rel> - 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