macOS Packaging: retry unmounting the disk image if failed
If it fails, the most common reason it that it is still in use by some process, probably a macOS process. Let's just wait a bit and retry.
This commit is contained in:
parent
250af5c6af
commit
256db894d1
1 changed files with 13 additions and 2 deletions
|
@ -202,8 +202,19 @@ echo "Codesign verify"
|
|||
codesign --verify --deep --strict --verbose=2 "${CODE_PATHS[@]}"
|
||||
|
||||
echo "Unmount"
|
||||
# Unmount the disk image
|
||||
hdiutil detach $DEV
|
||||
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
|
||||
# Unmount the disk image
|
||||
hdiutil detach $DEV
|
||||
if [ $? -eq 0 ]; then
|
||||
break
|
||||
fi
|
||||
if [ $i -eq 20 ]; then
|
||||
echo "Failed to unmount the disk image; exiting after 20 retries."
|
||||
exit 1
|
||||
fi
|
||||
echo "Failed to unmount the disk image; retrying in 30s"
|
||||
sleep 30
|
||||
done
|
||||
|
||||
# Convert the disk image to read-only
|
||||
hdiutil convert ${WORKING_DIRECTORY}/${DMGNAME} -format UDBZ -o ${WORKING_DIRECTORY}/${COMPRESSEDDMGNAME}
|
||||
|
|
Loading…
Reference in a new issue