From 3a179bf480804d6d6a846448535aff93c2591b0f Mon Sep 17 00:00:00 2001 From: ZongYangBigPolo <51826053+zongyangbigpolo@users.noreply.github.com> Date: Fri, 27 Feb 2026 17:37:54 +0800 Subject: [PATCH] [feat] add macOS installer icon and optimize packaging script (#70) --- scripts/macosx/pkg_arm64.sh | 33 +++++++++++++++++++++++++++++++++ scripts/macosx/pkg_x64.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/scripts/macosx/pkg_arm64.sh b/scripts/macosx/pkg_arm64.sh index 37321ff..709b1c3 100755 --- a/scripts/macosx/pkg_arm64.sh +++ b/scripts/macosx/pkg_arm64.sh @@ -138,6 +138,39 @@ productbuild \ echo "PKG package created: ${PKG_NAME}" +# Set custom icon for PKG file +if [ -f "${ICON_PATH}" ]; then + echo "Setting custom icon for PKG file..." + # Create a temporary iconset from icns + TEMP_ICON_DIR=$(mktemp -d) + cp "${ICON_PATH}" "${TEMP_ICON_DIR}/icon.icns" + + # Use sips to create a png from icns for the icon + sips -s format png "${TEMP_ICON_DIR}/icon.icns" --out "${TEMP_ICON_DIR}/icon.png" 2>/dev/null || true + + # Method: Use osascript to set file icon (works on macOS) + osascript </dev/null || true + + # Method: Use osascript to set file icon (works on macOS) + osascript <