summaryrefslogtreecommitdiff
path: root/export-image
diff options
context:
space:
mode:
Diffstat (limited to 'export-image')
-rwxr-xr-xexport-image/prerun.sh28
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"