From 6e70d34ddf3cfdc8677c683a593454eedc6991d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Sowa?= Date: Mon, 17 Dec 2018 01:02:18 +0100 Subject: [PATCH] Allow custom image filename --- build.sh | 1 + export-image/03-set-partuuid/00-run.sh | 2 +- export-image/04-finalise/01-run.sh | 4 ++-- export-image/prerun.sh | 2 +- export-noobs/prerun.sh | 6 +++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index ebeb46a..d21f855 100755 --- a/build.sh +++ b/build.sh @@ -134,6 +134,7 @@ fi export USE_QEMU="${USE_QEMU:-0}" export IMG_DATE="${IMG_DATE:-"$(date +%Y-%m-%d)"}" +export IMG_FILENAME="${IMG_FILENAME:-"${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}"}" BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" export SCRIPT_DIR="${BASE_DIR}/scripts" diff --git a/export-image/03-set-partuuid/00-run.sh b/export-image/03-set-partuuid/00-run.sh index 29edc67..e166e97 100755 --- a/export-image/03-set-partuuid/00-run.sh +++ b/export-image/03-set-partuuid/00-run.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -IMG_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.img" +IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}.img" IMGID="$(dd if="${IMG_FILE}" skip=440 bs=1 count=4 2>/dev/null | xxd -e | cut -f 2 -d' ')" diff --git a/export-image/04-finalise/01-run.sh b/export-image/04-finalise/01-run.sh index cd284ac..eee9c5c 100755 --- a/export-image/04-finalise/01-run.sh +++ b/export-image/04-finalise/01-run.sh @@ -1,7 +1,7 @@ #!/bin/bash -e -IMG_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.img" -INFO_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.info" +IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}.img" +INFO_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}.info" on_chroot << EOF /etc/init.d/fake-hwclock stop diff --git a/export-image/prerun.sh b/export-image/prerun.sh index 0ac7181..ca13b70 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -IMG_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.img" +IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}.img" unmount_image "${IMG_FILE}" diff --git a/export-noobs/prerun.sh b/export-noobs/prerun.sh index 1889567..47a4f9b 100755 --- a/export-noobs/prerun.sh +++ b/export-noobs/prerun.sh @@ -1,13 +1,13 @@ #!/bin/bash -e -IMG_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.img" +IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}.img" NOOBS_DIR="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}" unmount_image "${IMG_FILE}" mkdir -p "${STAGE_WORK_DIR}" -cp "${WORK_DIR}/export-image/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.img" "${STAGE_WORK_DIR}/" +cp "${WORK_DIR}/export-image/${IMG_FILENAME}.img" "${STAGE_WORK_DIR}/" -rm -rf "${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}" +rm -rf "${NOOBS_DIR}" PARTED_OUT=$(parted -s "${IMG_FILE}" unit b print) BOOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^ 1'| xargs echo -n \