CPack DMG (#120)

Co-authored-by: Chris Rizzitello <crizzitello@ics.com>
main
crizzitello 2022-04-12 18:03:30 -04:00 committed by GitHub
parent 3a5b1156fc
commit f71047721b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 67 additions and 10 deletions

View File

@ -69,6 +69,7 @@ jobs:
, QT_VERSION: 5.15.2 , QT_INST_DIR: /Users/runner
, QT_STRING: "Qt5"
, extraCMakeConfig: "-DQT_DEFAULT_MAJOR_VERSION=5 -DNOTARIZE_AS=\"John Kennedy\""
, buildTarget: "--target package"
}
- {
name: "Mac-Qt6"
@ -76,6 +77,7 @@ jobs:
, QT_VERSION: 6.2.4 , QT_INST_DIR: /Users/runner
, QT_STRING: "Qt6"
, extraCMakeConfig: "-DQT_DEFAULT_MAJOR_VERSION=6 -DNOTARIZE_AS=\"John Kennedy\""
, buildTarget: "--target package"
}
- {
name: "Windows-Qt5", WIN_ARCH: "x64"
@ -164,16 +166,12 @@ jobs:
-d deploy/ashirt.desktop \
-i deploy/hicolor/128x128/apps/ashirt.png \
--plugin=qt
elif [ "$RUNNER_OS" == "macOS" ]; then
macdeployqt ashirt.app -dmg
mv ashirt.dmg ${{env.name}}.dmg
if [ "${{ env.signRelease }}" == "true" ]; then
brew tap mitchellh/gon
brew install mitchellh/gon/gon jq
echo "${{ secrets.GON_CONF }}" | base64 -D -i - > notarize.json
env ID="${{ env.name }}.dmg" cat gon.json |jq '.notarize[0].path = env.ID'
gon notarize.json
fi
elif [[ "$RUNNER_OS" == "macOS" && "${{ env.signRelease }}" == "true" ]]; then
brew tap mitchellh/gon
brew install mitchellh/gon/gon jq
echo "${{ secrets.GON_CONF }}" | base64 -D -i - > notarize.json
env ID="${{ env.name }}.dmg" cat gon.json |jq '.notarize[0].path = env.ID'
gon notarize.json
fi
mv ashirt-*.* dist/

View File

@ -30,6 +30,13 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
FILES_MATCHING PATTERN "*.*"
)
set(CPACK_GENERATOR "NSIS")
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Qt${QT_DEFAULT_MAJOR_VERSION}-macos")
set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/deploy/dmg_icon.icns")
set(CPACK_DMG_BACKGROUND_IMAGE "${PROJECT_SOURCE_DIR}/deploy/dmg_background.png")
set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${PROJECT_SOURCE_DIR}/deploy/generate_ds_store.applescript")
set(CPACK_DMG_VOLUME_NAME "ashirt")
set(CPACK_GENERATOR "DragNDrop")
endif()
INCLUDE (CPack)

BIN
deploy/dmg_background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
deploy/dmg_icon.icns Normal file

Binary file not shown.

View File

@ -0,0 +1,52 @@
on run argv
set image_name to item 1 of argv
tell application "Finder"
tell disk image_name
-- wait for the image to finish mounting
set open_attempts to 0
repeat while open_attempts < 4
try
open
delay 1
set open_attempts to 5
close
on error errStr number errorNumber
set open_attempts to open_attempts + 1
delay 10
end try
end repeat
delay 5
-- open the image the first time and save a DS_Store with just
-- background and icon setup
open
set current view of container window to icon view
set theViewOptions to the icon view options of container window
set background picture of theViewOptions to file ".background:background.png"
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 192
set text size of theViewOptions to 16
delay 5
close
-- next setup the position of the app and Applications symlink
-- plus hide all the window decoration
open
tell container window
set sidebar width to 0
set statusbar visible to false
set toolbar visible to false
set the bounds to { 400, 100, 1200, 725 }
set position of item "ashirt.app" to { 0, 225 }
set position of item "README.MD" to { 250, 0 }
set position of item "Applications" to { 500, 225 }
end tell
delay 5
close
end tell
delay 1
end tell
end run