Skip to content

Commit

Permalink
Merge pull request #104 from smammy/ensure-min-image-size
Browse files Browse the repository at this point in the history
Make sure target image size is within limits.
  • Loading branch information
aonez committed Jan 2, 2021
2 parents 05609bd + f0bb382 commit 8350fcd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions create-dmg
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ fi
# Add extra space for additional resources
DISK_IMAGE_SIZE=$(expr $DISK_IMAGE_SIZE + 20)

# Make sure target image size is within limits
MIN_DISK_IMAGE_SIZE=$(hdiutil resize -limits "${DMG_TEMP_NAME}" | awk 'NR=1{print int($1/2048+1)}')
if [ $MIN_DISK_IMAGE_SIZE -gt $DISK_IMAGE_SIZE ]; then
DISK_IMAGE_SIZE=$MIN_DISK_IMAGE_SIZE
fi

# Resize the image for the extra stuff
hdiutil resize ${HDIUTIL_VERBOSITY} -size ${DISK_IMAGE_SIZE}m "${DMG_TEMP_NAME}"

Expand Down

0 comments on commit 8350fcd

Please sign in to comment.