update_package.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. echo "Change the permission of .dmg file"
  3. hdiutil convert "flameshot.dmg" -format UDRW -o "flameshot_rw.dmg"
  4. echo "Mount it and save the device"
  5. DEVICE=$(hdiutil attach -readwrite -noverify "flameshot_rw.dmg" | grep -E '^/dev/' | sed 1q | awk '{print $1}')
  6. sleep 5
  7. echo "Create the sysmbolic link to application folder"
  8. PATH_AT_VOLUME="/Volumes/flameshot/"
  9. CURRENT_PATH="$(pwd)"
  10. cd "${PATH_AT_VOLUME}"
  11. ln -s /Applications
  12. cd "${CURRENT_PATH}"
  13. # TODO - add background and icon location.
  14. # https://forum.qt.io/topic/94987/how-can-i-add-symbolic-link-application-and-background-image-in-dmg-package/3
  15. #echo "copy the background image in to package"
  16. #mkdir -p "${PATH_AT_VOLUME}".background/
  17. #cp backgroundImage.png "${PATH_AT_VOLUME}".background/
  18. #echo "done"
  19. #
  20. ## tell the Finder to resize the window, set the background,
  21. ## change the icon size, place the icons in the right position, etc.
  22. #echo '
  23. # tell application "Finder"
  24. # tell disk "/Volumes/src:flameshot"
  25. # open
  26. # set current view of container window to icon view
  27. # set toolbar visible of container window to false
  28. # set statusbar visible of container window to false
  29. # set the bounds of container window to {400, 100, 1110, 645}
  30. # set viewOptions to the icon view options of container window
  31. # set arrangement of viewOptions to not arranged
  32. # set icon size of viewOptions to 72
  33. # set background picture of viewOptions to file ".background:backgroundImage.png"
  34. # set position of item "flameshot.app" of container window to {160, 325}
  35. # set position of item "Applications" of container window to {560, 320}
  36. # close
  37. # open
  38. # update without registering applications
  39. # delay 2
  40. # end tell
  41. # end tell
  42. #' | osascript
  43. #
  44. #sync
  45. # unmount it
  46. hdiutil detach "${DEVICE}"
  47. rm -f "flameshot.dmg"
  48. hdiutil convert "flameshot_rw.dmg" -format UDZO -o "flameshot.dmg"
  49. rm -f "flameshot_rw.dmg"