create_snapshot.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #!/bin/bash
  2. # The new package will be saved here
  3. PACK_DIR=$PWD/doublecmd-release
  4. # Temp dir for creating *.dmg package
  5. BUILD_PACK_DIR=/var/tmp/doublecmd-$(date +%y.%m.%d)
  6. # Save revision number
  7. DC_REVISION=$(install/linux/update-revision.sh ./ ./)
  8. # Read version number
  9. DC_MAJOR=$(grep 'MajorVersionNr' src/doublecmd.lpi | grep -o '[0-9.]\+')
  10. DC_MINOR=$(grep 'MinorVersionNr' src/doublecmd.lpi | grep -o '[0-9.]\+' || echo 0)
  11. DC_MICRO=$(grep 'RevisionNr' src/doublecmd.lpi | grep -o '[0-9.]\+' || echo 0)
  12. DC_VER=$DC_MAJOR.$DC_MINOR.$DC_MICRO
  13. # Get libraries
  14. pushd install
  15. wget https://github.com/doublecmd/snapshots/raw/main/darwin.tar.gz
  16. tar xzf darwin.tar.gz
  17. rm -f darwin.tar.gz
  18. popd
  19. # Set widgetset
  20. export lcl=cocoa
  21. # Update application bundle version
  22. defaults write $(pwd)/doublecmd.app/Contents/Info CFBundleVersion $DC_REVISION
  23. defaults write $(pwd)/doublecmd.app/Contents/Info CFBundleShortVersionString $DC_VER
  24. plutil -convert xml1 $(pwd)/doublecmd.app/Contents/Info.plist
  25. chmod 644 $(pwd)/doublecmd.app/Contents/Info.plist
  26. build_doublecmd()
  27. {
  28. # Build all components of Double Commander
  29. ./build.sh release
  30. # Copy libraries
  31. cp -a install/darwin/lib/$CPU_TARGET/*.dylib ./
  32. # Prepare *.dmg package
  33. mkdir -p $BUILD_PACK_DIR
  34. install/darwin/install.sh $BUILD_PACK_DIR
  35. pushd $BUILD_PACK_DIR
  36. mv doublecmd.app 'Double Commander.app'
  37. codesign --deep --force --verify --verbose --sign '-' 'Double Commander.app'
  38. popd
  39. # Create *.dmg package
  40. HDI_TRY=0
  41. HDI_MAX=5
  42. while true; do
  43. HDI_TRY=$((HDI_TRY+1))
  44. echo "Try to create a package $HDI_TRY ..."
  45. # Bug: https://github.com/actions/runner-images/issues/7522
  46. echo Killing XProtect...; sudo pkill -9 XProtect >/dev/null || true;
  47. echo Waiting for XProtect process...; while pgrep XProtect; do sleep 3; done;
  48. sudo install/darwin/create-dmg/create-dmg \
  49. --volname "Double Commander" \
  50. --volicon "$BUILD_PACK_DIR/.VolumeIcon.icns" \
  51. --background "$BUILD_PACK_DIR/.background/bg.jpg" \
  52. --window-pos 200 200 \
  53. --window-size 680 366 \
  54. --text-size 16 \
  55. --icon-size 128 \
  56. --icon "Double Commander.app" 110 120 \
  57. --app-drop-link 360 120 \
  58. --icon "install.txt" 566 123 \
  59. --icon ".background" 100 500 \
  60. "$PACK_DIR/doublecmd-$DC_VER-$DC_REVISION.$lcl.$CPU_TARGET.dmg" \
  61. "$BUILD_PACK_DIR/"
  62. if [ $? -eq 0 ]; then
  63. break
  64. fi
  65. if [ $HDI_TRY -eq $HDI_MAX ]; then
  66. break
  67. fi
  68. sleep 10
  69. done
  70. # Clean DC build dir
  71. ./clean.sh
  72. rm -rf $BUILD_PACK_DIR
  73. }
  74. mkdir -p $PACK_DIR
  75. echo $DC_REVISION > $PACK_DIR/revision.php
  76. # Set processor architecture
  77. export CPU_TARGET=aarch64
  78. # Set minimal Mac OS X target version
  79. export MACOSX_DEPLOYMENT_TARGET=11.0
  80. build_doublecmd
  81. # Set processor architecture
  82. export CPU_TARGET=x86_64
  83. # Set minimal Mac OS X target version
  84. export MACOSX_DEPLOYMENT_TARGET=11.0
  85. build_doublecmd