Skip to content

Commit

Permalink
dmg allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
danemadsen committed Jul 4, 2024
1 parent f6b8d36 commit b3ace06
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/scripts/create_dmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ DMG_TEMPLATE="./.github/assets/maid.dmg"
DMG_OUTPUT="./dmg/${APP_NAME}.dmg"
TMP_MOUNT="/tmp/Maid"
TMP_DMG="/tmp/${APP_NAME}_tmp.dmg"
DMG_SIZE=1g

# Create the dmg directory if it does not exist
mkdir -p "$(dirname ${DMG_OUTPUT})"
mkdir -p ${TMP_MOUNT}

# Convert the template DMG to a writable DMG
# Convert the template DMG to a writable DMG with increased size
hdiutil convert ${DMG_TEMPLATE} -format UDRW -o ${TMP_DMG}
hdiutil resize -size ${DMG_SIZE} ${TMP_DMG}.dmg

# Mount the writable DMG
hdiutil attach ${TMP_DMG} -mountpoint ${TMP_MOUNT} -nobrowse -noverify -noautoopen
hdiutil attach ${TMP_DMG}.dmg -mountpoint ${TMP_MOUNT} -nobrowse -noverify -noautoopen

# Replace the TARGET file with maid.app
rm -rf "${TMP_MOUNT}/TARGET"
Expand All @@ -27,9 +29,9 @@ cp -R "${APP_DIR}" "${TMP_MOUNT}/maid.app"
hdiutil detach ${TMP_MOUNT}

# Convert the writable DMG to a compressed DMG
hdiutil convert ${TMP_DMG} -format UDZO -o ${DMG_OUTPUT}
hdiutil convert ${TMP_DMG}.dmg -format UDZO -o ${DMG_OUTPUT}

# Clean up the temporary writable DMG
rm ${TMP_DMG}
rm ${TMP_DMG}.dmg

echo "DMG creation completed successfully!"

0 comments on commit b3ace06

Please sign in to comment.