-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_dmg.sh
More file actions
executable file
·39 lines (28 loc) · 1.01 KB
/
create_dmg.sh
File metadata and controls
executable file
·39 lines (28 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Set variables
APP_NAME="ANIE"
DMG_NAME="${APP_NAME}_1.0preview4"
VOLUME_NAME="${APP_NAME} Installer"
SOURCE_DIR="downloads"
DMG_DIR="downloads"
TMP_DMG="${DMG_DIR}/${DMG_NAME}_tmp.dmg"
FINAL_DMG="${DMG_DIR}/${DMG_NAME}.dmg"
# Create a temporary DMG
hdiutil create -size 100m -fs HFS+ -volname "${VOLUME_NAME}" "${TMP_DMG}"
# Mount the temporary DMG
hdiutil attach "${TMP_DMG}"
# Get the device name
DEVICE_NAME=$(hdiutil info | grep "${VOLUME_NAME}" | grep "/dev/" | awk '{print $1}')
# Copy the .app to the mounted DMG
cp -R "${SOURCE_DIR}/${APP_NAME}.app" "/Volumes/${VOLUME_NAME}/"
# Create Applications shortcut
ln -s /Applications "/Volumes/${VOLUME_NAME}/Applications"
# Set custom icon and background (optional)
# Add custom styling here if needed
# Unmount the temporary DMG
hdiutil detach "${DEVICE_NAME}"
# Convert the temporary DMG to the final compressed DMG
hdiutil convert "${TMP_DMG}" -format UDZO -o "${FINAL_DMG}"
# Clean up
rm "${TMP_DMG}"
echo "DMG created successfully at ${FINAL_DMG}"