File: macos_createdmg.sh

package info (click to toggle)
trustedqsl 2.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 38,012 kB
  • sloc: cpp: 36,137; xml: 7,977; javascript: 6,989; ansic: 634; sh: 149; makefile: 19; python: 18
file content (87 lines) | stat: -rwxr-xr-x 3,791 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh

TQSLVER=`cat apps/tqslversion.ver|sed -e 's/\.0$//'`
TQSLLIBPATH=`pwd`/src/libtqsllib.dylib
WORKDIR=`mktemp -d /tmp/tqsl.XXXXX` || exit 1
WINHELPFILE=$WORKDIR/TrustedQSL/$app.app/Contents/Resources/Help/tqslapp.chm
IMGNAME="tqsl"
KEYCHAIN="/Library/Keychains/System.keychain"
KEYCHAIN="$HOME/Library/Keychains/Login.keychain-db"
SIGNOPTS="--options runtime --timestamp"

if [ "x$1" = "x-legacy" ]; then
	SIGNOPTS=""			# Legacy can't have the hardened runtime
	shift
fi

file apps/tqsl.app/Contents/MacOS/tqsl | grep -q ppc && IMGNAME="tqsl-legacy"
file apps/tqsl.app/Contents/MacOS/tqsl | grep -q i386 && IMGNAME="tqsl-legacy"

/bin/echo -n "Copying files to image directory... "

mkdir $WORKDIR/TrustedQSL
cp apps/ChangeLog.txt $WORKDIR/TrustedQSL/ChangeLog.txt
cp LICENSE.txt $WORKDIR/TrustedQSL/
cp apps/quick "$WORKDIR/TrustedQSL/Quick Start.txt"
cp -r apps/tqsl.app $WORKDIR/TrustedQSL

/bin/echo "done"

/bin/echo -n "Installing the libraries and tweaking the binaries to look for them... "

for app in tqsl
do
    cp $TQSLLIBPATH $WORKDIR/TrustedQSL/$app.app/Contents/MacOS
    [ -f $WINHELPFILE ] && rm $WINHELPFILE
    install_name_tool -change $TQSLLIBPATH @executable_path/libtqsllib.dylib $WORKDIR/TrustedQSL/$app.app/Contents/MacOS/$app
    cp src/config.xml $WORKDIR/TrustedQSL/$app.app/Contents/Resources
    cp apps/ca-bundle.crt $WORKDIR/TrustedQSL/$app.app/Contents/Resources
    cp apps/languages.dat $WORKDIR/TrustedQSL/$app.app/Contents/Resources
    cp apps/cab_modes.dat $WORKDIR/TrustedQSL/$app.app/Contents/Resources
    cp apps/vuccgrids.dat $WORKDIR/TrustedQSL/$app.app/Contents/Resources
    cp apps/prefixes.dat $WORKDIR/TrustedQSL/$app.app/Contents/Resources
    for lang in ca_ES de es fi fr hi_IN it ja pl_PL pt ru sv_SE tr_TR zh_CN zh_TW
    do
	mkdir $WORKDIR/TrustedQSL/$app.app/Contents/Resources/$lang.lproj
	cp apps/lang/$lang/tqslapp.mo $WORKDIR/TrustedQSL/$app.app/Contents/Resources/$lang.lproj
	[ -f apps/lang/$lang/wxstd.mo ] && cp apps/lang/$lang/wxstd.mo $WORKDIR/TrustedQSL/$app.app/Contents/Resources/$lang.lproj
	[ -f apps/lang/$lang/wxstd-3.2.mo ] && cp apps/lang/$lang/wxstd-3.2.mo $WORKDIR/TrustedQSL/$app.app/Contents/Resources/$lang.lproj
    done
# Make an empty 'en.lproj' folder so wx knows it's default
    mkdir $WORKDIR/TrustedQSL/$app.app/Contents/Resources/en.lproj
done

/bin/echo "done"

/bin/echo -n "Installing the help... "

cp -r apps/help/tqslapp $WORKDIR/TrustedQSL/tqsl.app/Contents/Resources/Help

/bin/echo "done"

/bin/echo "Creating the disk image..."

#hdiutil uses dots to show progress
hdiutil create -ov -srcfolder $WORKDIR -volname "TrustedQSL v$TQSLVER" "$IMGNAME-$TQSLVER.dmg"

if [ "x$1" != "x" ]; then
	echo "Codesigning as $1"
	plutil -replace CFBundleName -string tqsl ${WORKDIR}/TrustedQSL/tqsl.app/Contents/Info.plist
	echo codesign --deep --options runtime --timestamp --verbose --sign "$1" --keychain $KEYCHAIN $WORKDIR/TrustedQSL/tqsl.app
	codesign --deep --options runtime --timestamp --verbose --sign "$1" --keychain $KEYCHAIN $WORKDIR/TrustedQSL/tqsl.app
# Check that it signed OK
	codesign --verify $WORKDIR/TrustedQSL/tqsl.app || exit 1
fi
/bin/echo "Creating a package..."
pkgbuild --analyze --root $WORKDIR/TrustedQSL ${WORKDIR}/tqslapp.plist
plutil -replace BundleIsRelocatable -bool NO ${WORKDIR}/tqslapp.plist

if [ "x$2" != "x" ]; then
	pkgbuild --root ${WORKDIR}//TrustedQSL --component-plist ${WORKDIR}/tqslapp.plist --install-location /Applications/TrustedQSL `pwd`/${IMGNAME}-${TQSLVER}.pkg --keychain $KEYCHAIN --sign "$2"
else
	pkgbuild --root ${WORKDIR}//TrustedQSL --component-plist ${WORKDIR}/tqslapp.plist --install-location /Applications/TrustedQSL `pwd`/${IMGNAME}-${TQSLVER}.pkg
fi

/bin/echo -n "Cleaning up temporary files.. "
rm -r $WORKDIR
/bin/echo "Finished!"