Skip to content

Commit

Permalink
read only fix
Browse files Browse the repository at this point in the history
  • Loading branch information
danemadsen committed Jul 4, 2024
1 parent 097dfd8 commit 6d46036
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/scripts/create_dmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,29 @@ APP_DIR="build/macos/Build/Products/Release/${APP_NAME}.app"
DMG_TEMPLATE="./.github/assets/maid.dmg"
DMG_OUTPUT="./dmg/${APP_NAME}.dmg"
TMP_MOUNT="/tmp/Maid"
TMP_DMG="/tmp/${APP_NAME}_tmp.dmg"

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

# Mount the template DMG
hdiutil attach ${DMG_TEMPLATE} -mountpoint ${TMP_MOUNT} -nobrowse -noverify -noautoopen
# Convert the template DMG to a writable DMG
hdiutil convert ${DMG_TEMPLATE} -format UDRW -o ${TMP_DMG}

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

# Replace the TARGET file with maid.app
rm -rf "${TMP_MOUNT}/TARGET"
cp -R "${APP_DIR}" "${TMP_MOUNT}/maid.app"

# Unmount the template DMG
# Unmount the writable DMG
hdiutil detach ${TMP_MOUNT}

# Create the final DMG from the modified template
hdiutil convert ${DMG_TEMPLATE} -format UDZO -o ${DMG_OUTPUT}
# Convert the writable DMG to a compressed DMG
hdiutil convert ${TMP_DMG} -format UDZO -o ${DMG_OUTPUT}

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

echo "DMG creation completed successfully!"

0 comments on commit 6d46036

Please sign in to comment.