Created
May 2, 2022 23:32
-
-
Save hafta/ad3f3497b9b41c90acf8822e71793cb0 to your computer and use it in GitHub Desktop.
Creates a macOS .dmg from a .app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create a .dmg from the provided .app. Accepts a single argument | |
# which should be something like | |
# | |
# ~/mybuilds/Firefox.app | |
# | |
# Uses a 1024m disk image file. Increase as necessary. | |
set -x | |
APP_PATH=$1 | |
DISK_IMAGE_DIR=`mktemp -d` | |
TEMP_FILE=`mktemp` | |
TEMP_DMG=${TEMP_FILE}.dmg | |
NAME=`basename "${APP_PATH}" .app` | |
ditto "${APP_PATH}" "${DISK_IMAGE_DIR}/${NAME}.app" | |
hdiutil create -size 1024m -fs HFS+ -volname Firefox -srcfolder "${DISK_IMAGE_DIR}" "${TEMP_DMG}" | |
hdiutil convert -format UDZO -o "${NAME}.dmg" "${TEMP_DMG}" | |
rm ${TEMP_FILE} | |
rm ${TEMP_DMG} | |
rm -rf "${DISK_IMAGE_DIR}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment