Skip to content

Commit

Permalink
Add sha256 creation for image file in release #151
Browse files Browse the repository at this point in the history
  • Loading branch information
guysoft committed Jan 19, 2022
1 parent 612ed4b commit 6d58e89
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/nightly_build_scripts/custompios_nightly_build
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ pushd "${DIST_PATH}"
echo "build script failed"
exit $exit_code
fi
bash -x ${CUSTOM_PI_OS_PATH}/release $1
bash -x ${CUSTOM_PI_OS_PATH}/release --sha256 $1
chmod 777 ${DIST_PATH}/workspace${WORKSPACE_POSTFIX}/*
popd
24 changes: 20 additions & 4 deletions src/release
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
#!/usr/bin/env bash
if [ -z "$1" ] || [ "$1" == "default" ] ;then
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

source "$DIR/argparse.bash" || exit 1
argparse "$@" <<EOF || exit 1
parser.add_argument('WORKSPACE_SUFFIX', nargs='?', default="default", help="The workspace folder suffix used folder")
parser.add_argument('-s', '--sha256', action='store_true', help='Create a sha256 hash for the .img file in .sha256')
EOF


if [ -z "$WORKSPACE_SUFFIX" ] || [ "$WORKSPACE_SUFFIX" == "default" ] ;then
pushd workspace
else
pushd workspace-$1
pushd workspace-$WORKSPACE_SUFFIX
fi

if [ -z "${CUSTOM_PI_OS_PATH}" ];then
Expand All @@ -25,10 +35,10 @@ if [ "${BASE_RELEASE_IMG_NAME}" == "default" ]; then
# Handle variant name
for CHANGE_STRING in "${CHANGE_STRING_LIST[@]}"
do
if [ -z "$1" ] || [ "$BASE_IGNORE_VARIANT_NAME" == "yes" ] ;then
if [ -z "$WORKSPACE_SUFFIX" ] || [ "$BASE_IGNORE_VARIANT_NAME" == "yes" ] ;then
IMG_FILENAME=$(echo "${FILENAME::-4}"-"${DIST_VERSION}" | sed "s/${CHANGE_STRING}/${DIST_NAME,,}/").img
else
IMG_FILENAME=$(echo "${FILENAME::-4}"-"${DIST_VERSION}" | sed "s/${CHANGE_STRING}/${DIST_NAME,,}-$1/").img
IMG_FILENAME=$(echo "${FILENAME::-4}"-"${DIST_VERSION}" | sed "s/${CHANGE_STRING}/${DIST_NAME,,}-$WORKSPACE_SUFFIX/").img
fi
done
else
Expand All @@ -55,4 +65,10 @@ else
echo "Not compressing because setting is disabled"
fi

# store_true in argparse variables are either "yes" or ""
if [ "${SHA256}" == "yes" ]; then
echo "Saving image hash type sha256"
sha256sum "${IMG_FILENAME}" > "${IMG_FILENAME}".sha256
fi

popd

0 comments on commit 6d58e89

Please sign in to comment.