Add a DEPLOY_ZIP setting

This commit is contained in:
Louis Matthijssen 2019-01-30 19:09:36 +01:00 committed by XECDesign
parent d945d422d4
commit 61a994c88c
3 changed files with 14 additions and 4 deletions

View File

@ -68,6 +68,10 @@ The following environment variables are supported:
Output directory for target system images and NOOBS bundles.
* `DEPLOY_ZIP` (Default: `1`)
Setting to `0` will deploy the actual image (`.img`) instead of a zipped image (`.zip`).
* `USE_QEMU` (Default: `"0"`)
Setting to '1' enables the QEMU mode - creating an image that can be mounted via QEMU for an emulated

View File

@ -151,6 +151,7 @@ BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export SCRIPT_DIR="${BASE_DIR}/scripts"
export WORK_DIR="${WORK_DIR:-"${BASE_DIR}/work/${IMG_DATE}-${IMG_NAME}"}"
export DEPLOY_DIR=${DEPLOY_DIR:-"${BASE_DIR}/deploy"}
export DEPLOY_ZIP="${DEPLOY_ZIP:-1}"
export LOG_FILE="${WORK_DIR}/build.log"
export FIRST_USER_NAME=${FIRST_USER_NAME:-pi}

View File

@ -75,10 +75,15 @@ unmount_image "${IMG_FILE}"
mkdir -p "${DEPLOY_DIR}"
rm -f "${DEPLOY_DIR}/${ZIP_FILENAME}${IMG_SUFFIX}.zip"
rm -f "${DEPLOY_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
pushd "${STAGE_WORK_DIR}" > /dev/null
zip "${DEPLOY_DIR}/${ZIP_FILENAME}${IMG_SUFFIX}.zip" \
"$(basename "${IMG_FILE}")"
popd > /dev/null
if [ "${DEPLOY_ZIP}" == "1" ]; then
pushd "${STAGE_WORK_DIR}" > /dev/null
zip "${DEPLOY_DIR}/${ZIP_FILENAME}${IMG_SUFFIX}.zip" \
"$(basename "${IMG_FILE}")"
popd > /dev/null
else
cp "$IMG_FILE" "$DEPLOY_DIR"
fi
cp "$INFO_FILE" "$DEPLOY_DIR"