| 1 | #!/bin/sh |
| 2 | |
| 3 | adonthell_exe="adonthell-0.3" |
| 4 | |
| 5 | # -- check arg |
| 6 | if test "x$1" = "x" ; then |
| 7 | echo "Usage: $0 <path/to/Adonthell.App>" |
| 8 | exit 1 |
| 9 | fi |
| 10 | |
| 11 | # -- remove traiing slash, if present |
| 12 | bundle=${1%/} |
| 13 | |
| 14 | if test ! -f $bundle"/Contents/MacOS/$adonthell_exe" ; then |
| 15 | echo "Error: $bundle is not the expected App bundle" |
| 16 | exit 1 |
| 17 | fi |
| 18 | |
| 19 | # -- check working directory |
| 20 | if [ ! -f "background.png" ]; then |
| 21 | echo "This script must be run in the wastesedge-0.3.x/osx directory" |
| 22 | exit 1 |
| 23 | fi |
| 24 | |
| 25 | # -- check dmgbuild |
| 26 | if [ ! -x "$(command -v dmgbuild)" ]; then |
| 27 | echo "This script requires dmgbuild installed and in your PATH" |
| 28 | echo "See https://pypi.python.org/pypi/dmgbuild" |
| 29 | exit 1 |
| 30 | fi |
| 31 | |
| 32 | # -- get adonthell version |
| 33 | adonthell_ver=`$bundle/Contents/MacOS/$adonthell_exe -v` |
| 34 | |
| 35 | # -- codesign Adonthell.App |
| 36 | if [ ! -z "$CODESIGN_IDENTITY" ]; then |
| 37 | echo "Signing $bundle as $CODESIGN_IDENTITY" |
| 38 | codesign -s "$CODESIGN_IDENTITY" --entitlements sandbox.plist --force --deep $bundle |
| 39 | cat > $bundle/Contents/Resources/container-migration.plist <<EOF |
| 40 | <?xml version="1.0" encoding="UTF-8"?> |
| 41 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 42 | <plist version="1.0"> |
| 43 | <dict> |
| 44 | <key>Move</key> |
| 45 | <array> |
| 46 | <array> |
| 47 | <string>\${ApplicationSupport}/Adonthell</string> |
| 48 | <string>\${ApplicationSupport}/Adonthell</string> |
| 49 | </array> |
| 50 | </array> |
| 51 | </dict> |
| 52 | </plist> |
| 53 | EOF |
| 54 | else |
| 55 | echo "CODESIGN_IDENTITY not defined. Will not sign Adonthell.app" |
| 56 | fi |
| 57 | |
| 58 | echo "Creating wastesedge-osx-x86_64-$adonthell_ver.dmg" |
| 59 | |
| 60 | # -- clean up any __pycache__ directories before collecting package contents |
| 61 | find $bundle -name __pycache__ -execdir rm -rf __pycache__ \; |
| 62 | |
| 63 | dmgbuild -s settings.py -Dapp=$bundle "Adonthell - Waste's Edge" wastesedge-osx-x86_64-$adonthell_ver.dmg |
| 64 | |
| 65 | # -- codesign diskimage (requires OSX 10.11.4 or later) |
| 66 | if [ ! -z "$CODESIGN_IDENTITY" ]; then |
| 67 | echo "Signing wastesedge-osx-x86_64-$adonthell_ver.dmg as $CODESIGN_IDENTITY" |
| 68 | codesign -s "$CODESIGN_IDENTITY" wastesedge-osx-x86_64-$adonthell_ver.dmg |
| 69 | fi |