Browse Source

MacOS - add Application link to the package

Yuriy Puchkov 4 years ago
parent
commit
ea11797d07
3 changed files with 63 additions and 3 deletions
  1. 7 2
      .github/workflows/MacOS-pack.yml
  2. 55 0
      packaging/macos/update_package.sh
  3. 1 1
      src/CMakeLists.txt

+ 7 - 2
.github/workflows/MacOS-pack.yml

@@ -41,12 +41,17 @@ jobs:
           cd build
           make
 
-      - name: Build dmg image
+      - name: Build dmg package
         run: |
           cd build
           /usr/local/opt/qt5/bin/macdeployqt src/flameshot.app -dmg
 
-      - name: Upload dmg image
+      - name: Update dmg package links
+        run: |
+          cd build/src
+          ../../packaging/macos/update_package.sh
+
+      - name: Upload dmg package
         shell: bash
         run: |
           python3 -m pip install -U -q requests

+ 55 - 0
packaging/macos/update_package.sh

@@ -0,0 +1,55 @@
+#!/bin/bash
+
+echo "Change the permision of .dmg file"
+hdiutil convert "flameshot.dmg" -format UDRW -o "flameshot_rw.dmg"
+
+echo "Mount it and save the device"
+DEVICE=$(hdiutil attach -readwrite -noverify "flameshot_rw.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}')
+sleep 5
+
+echo "Create the sysmbolic link to application folder"
+PATH_AT_VOLUME="/Volumes/src:flameshot/"
+CURRENT_PATH="$(pwd)"
+cd "${PATH_AT_VOLUME}"
+ln -s /Applications
+cd "${CURRENT_PATH}"
+
+# TODO - add background and icon location.
+# https://forum.qt.io/topic/94987/how-can-i-add-symbolic-link-application-and-background-image-in-dmg-package/3
+#echo "copy the background image in to package"
+#mkdir -p "${PATH_AT_VOLUME}".background/
+#cp backgroundImage.png "${PATH_AT_VOLUME}".background/
+#echo "done"
+#
+## tell the Finder to resize the window, set the background,
+##  change the icon size, place the icons in the right position, etc.
+#echo '
+#    tell application "Finder"
+#    tell disk "/Volumes/src:flameshot"
+#        open
+#            set current view of container window to icon view
+#            set toolbar visible of container window to false
+#            set statusbar visible of container window to false
+#            set the bounds of container window to {400, 100, 1110, 645}
+#            set viewOptions to the icon view options of container window
+#            set arrangement of viewOptions to not arranged
+#            set icon size of viewOptions to 72
+#            set background picture of viewOptions to file ".background:backgroundImage.png"
+#            set position of item "flameshot.app" of container window to {160, 325}
+#            set position of item "Applications" of container window to {560, 320}
+#        close
+#        open
+#        update without registering applications
+#        delay 2
+#    end tell
+#    end tell
+#' | osascript
+#
+#sync
+
+# unmount it
+hdiutil detach "${DEVICE}"
+rm -f "flameshot.dmg"
+
+hdiutil convert "flameshot_rw.dmg" -format UDZO -o "flameshot.dmg"
+rm -f "flameshot_rw.dmg"

+ 1 - 1
src/CMakeLists.txt

@@ -167,7 +167,7 @@ else()
 endif()
 
 if(NOT USE_OPENSSL)
-  message(WARNING "OpenSSL is required to upload screenshot to imgur")
+  message(WARNING "OpenSSL is required to upload screenshots")
 endif()
 
 target_compile_definitions(flameshot PRIVATE APP_PREFIX="${CMAKE_INSTALL_PREFIX}")