diff --git a/scripts/create_dmg.sh b/scripts/create_dmg.sh index b9ec59a6..c1803814 100644 --- a/scripts/create_dmg.sh +++ b/scripts/create_dmg.sh @@ -222,22 +222,36 @@ if [ -f "$OUTPUT_DMG" ]; then rm -f "$OUTPUT_DMG" fi -# Create DMG using create-dmg -create-dmg \ - --volname "LuckyWorld ${VERSION}" \ - --volicon "$(dirname "$0")/assets/LuckyWorld.icns" \ +# Check if icon file exists +ICON_PATH="$(dirname "$0")/assets/LuckyWorld.icns" +VOLICON_PARAM="" +if [ -f "$ICON_PATH" ]; then + echo -e "${GREEN}Using volume icon: $ICON_PATH${NC}" + VOLICON_PARAM="--volicon \"$ICON_PATH\"" +else + echo -e "${YELLOW}Volume icon not found at $ICON_PATH. Creating DMG without custom icon.${NC}" +fi + +# Create DMG using create-dmg with dynamic volicon parameter +CMD_CREATE_DMG="create-dmg \ + --volname \"LuckyWorld ${VERSION}\" \ + $VOLICON_PARAM \ --window-pos 200 120 \ --window-size 800 500 \ --icon-size 128 \ - --icon "LuckyWorld.app" 200 250 \ - --icon "install_luckyworld.sh" 400 250 \ - --icon "README.txt" 600 250 \ - --hide-extension "LuckyWorld.app" \ - --hide-extension "install_luckyworld.sh" \ + --icon \"LuckyWorld.app\" 200 250 \ + --icon \"install_luckyworld.sh\" 400 250 \ + --icon \"README.txt\" 600 250 \ + --hide-extension \"LuckyWorld.app\" \ + --hide-extension \"install_luckyworld.sh\" \ --app-drop-link 400 120 \ --no-internet-enable \ - "$OUTPUT_DMG" \ - "$TEMP_DIR" + \"$OUTPUT_DMG\" \ + \"$TEMP_DIR\"" + +# Execute the command +echo -e "${BLUE}Executing: $CMD_CREATE_DMG${NC}" +eval $CMD_CREATE_DMG # Check if DMG creation was successful if [ $? -ne 0 ]; then