1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-29 23:07:42 +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) # 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) # -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) # [-a|--archive] - Archive the build (to the export location)
# [-o|--output] - Redirect export / archiving to another location # [-o|--output] - Redirect export / archiving to another location
# (By default export to origin config folder) # (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) 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) -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) [-a|--archive] - Archive the build (to the export location)
[-o|--output] - Redirect export / archiving to another location [-o|--output] - Redirect export / archiving to another location
(By default export to origin config folder) (By default export to origin config folder)
@ -195,15 +195,19 @@ if ((ARCHIVE)); then
rm -f "$ARCSUB"/*.bin.tar.gz "$ARCSUB"/*.hex.tar.gz rm -f "$ARCSUB"/*.bin.tar.gz "$ARCSUB"/*.hex.tar.gz
find "$BUILD" \( "${BNAME[@]}" \) -exec sh -c ' find "$BUILD" \( "${BNAME[@]}" \) -exec sh -c '
ARCSUB="$1" ARCSUB="$1"
shift 1 CONFIG="$2"
for file in "$@"; do shift 2
cd "$(dirname "$file")" for FILE in "$@"; do
base=$(basename "$file") cd "${FILE%/*}"
tar -czf "$ARCSUB/$base.tar.gz" "$base" BASE=${FILE##*/}
rm "$base" 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 cd - >/dev/null
done done
' sh "$ARCSUB" {} + ' sh "$ARCSUB" "$CONFIG" {} +
fi fi
# Exit with error unless --nofail is set # Exit with error unless --nofail is set