diff options
author | kdoren <[email protected]> | 2020-09-23 11:54:37 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2020-09-23 19:54:37 +0100 |
commit | d1596451b9d81c360c6cf89a10ed1c30e19e4e02 (patch) | |
tree | cd00e999279ff77b61e600f9a2c2e0dbd61b7153 /export-image/prerun.sh | |
parent | be8daaa7210d8a8df77792e7bcb3ec509d8e995e (diff) |
workaround build failure on AWS M6g instances (#449)
Diffstat (limited to 'export-image/prerun.sh')
-rwxr-xr-x | export-image/prerun.sh | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/export-image/prerun.sh b/export-image/prerun.sh index 8bbc566..4b5cf8c 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -39,8 +39,32 @@ BOOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^1:' | cut -d':' -f 4 | tr -d B) ROOT_OFFSET=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 2 | tr -d B) ROOT_LENGTH=$(echo "$PARTED_OUT" | grep -e '^2:' | cut -d':' -f 4 | tr -d B) -BOOT_DEV=$(losetup --show -f -o "${BOOT_OFFSET}" --sizelimit "${BOOT_LENGTH}" "${IMG_FILE}") -ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}") +echo "Mounting BOOT_DEV..." +cnt=0 +until BOOT_DEV=$(losetup --show -f -o "${BOOT_OFFSET}" --sizelimit "${BOOT_LENGTH}" "${IMG_FILE}"); do + if [ $cnt -lt 5 ]; then + cnt=$((cnt + 1)) + echo "Error in losetup for BOOT_DEV. Retrying..." + sleep 5 + else + echo "ERROR: losetup for BOOT_DEV failed; exiting" + exit 1 + fi +done + +echo "Mounting ROOT_DEV..." +cnt=0 +until ROOT_DEV=$(losetup --show -f -o "${ROOT_OFFSET}" --sizelimit "${ROOT_LENGTH}" "${IMG_FILE}"); do + if [ $cnt -lt 5 ]; then + cnt=$((cnt + 1)) + echo "Error in losetup for ROOT_DEV. Retrying..." + sleep 5 + else + echo "ERROR: losetup for ROOT_DEV failed; exiting" + exit 1 + fi +done + echo "/boot: offset $BOOT_OFFSET, length $BOOT_LENGTH" echo "/: offset $ROOT_OFFSET, length $ROOT_LENGTH" |