From 61a994c88ceb4a9ded0aca5eeedbe56c801b5acd Mon Sep 17 00:00:00 2001 From: Louis Matthijssen Date: Wed, 30 Jan 2019 19:09:36 +0100 Subject: [PATCH] Add a DEPLOY_ZIP setting --- README.md | 4 ++++ build.sh | 1 + export-image/04-finalise/01-run.sh | 13 +++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index da22352..8a4f64a 100755 --- a/README.md +++ b/README.md @@ -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 diff --git a/build.sh b/build.sh index 78f2fb5..3e04204 100755 --- a/build.sh +++ b/build.sh @@ -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} diff --git a/export-image/04-finalise/01-run.sh b/export-image/04-finalise/01-run.sh index d4788c7..2a84173 100755 --- a/export-image/04-finalise/01-run.sh +++ b/export-image/04-finalise/01-run.sh @@ -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"