forked from corellium/usbfluxd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makedmg.sh
executable file
·78 lines (61 loc) · 2.69 KB
/
makedmg.sh
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
#!/bin/sh
VER="1.0"
CONFIG_VERSION="$(grep AC_INIT configure.ac |cut -d "[" -f3 |cut -d "]" -f 1)"
if test -n "${CONFIG_VERSION}"; then
VER="${CONFIG_VERSION}"
fi
PKGNAME="USBFlux-${VER}"
BUILDDIR="USBFlux/build/Release"
# build the daemon
make clean && make
# sign it
codesign -s "Developer ID Application: Corellium LLC (XG264R6QP8)" usbfluxd/usbfluxd
COMMIT="$(git rev-parse HEAD)"
if test -z "${COMMIT}"; then
COMMIT="nogit"
fi
THISDIR="$(pwd)"
# build the GUI app
cd USBFlux || return
xcodebuild clean build
cd "${THISDIR}" || return
SRCDIR="/tmp/dmgsrc"
rm -rf ${SRCDIR}
mkdir -p ${SRCDIR}
cp -a "${BUILDDIR}/USBFlux.app" ${SRCDIR}/
ln -s /Applications "${SRCDIR}/ "
if test -f USBFlux.pdf; then
cp USBFlux.pdf ${SRCDIR}/
fi
DMG_NAME_MDNS="${PKGNAME}-${COMMIT}.dmg"
ZIP_NAME_MDNS="${PKGNAME}-${COMMIT}.zip"
DMG_NAME_API="${PKGNAME}-onsite-${COMMIT}.dmg"
ZIP_NAME_API="${PKGNAME}-onsite-${COMMIT}.zip"
rm -f "${DMG_NAME_MDNS}"
rm -f "${ZIP_NAME_MDNS}"
rm -f "${DMG_NAME_API}"
rm -f "${ZIP_NAME_API}"
if ! test -x create-dmg/create-dmg; then
rm -rf create-dmg
curl -L https://github.com/nikias/create-dmg/archive/master.zip > create-dmg.zip
unzip create-dmg.zip
mv create-dmg-master create-dmg
rm -f create-dmg.zip
chmod 755 create-dmg/create-dmg
cd "${THISDIR}" || return
fi
./create-dmg/create-dmg --volname "USBFlux ${VER}" --volicon USBFlux/VolumeIcon.icns --background USBFlux/background.png --window-size 800 421 --icon-size 128 --icon USBFlux.app 0 0 --icon " " 340 0 --icon USBFlux.pdf 0 200 "${DMG_NAME_MDNS}" "${SRCDIR}"
cd "${SRCDIR}" || return
zip -r "${THISDIR}/${ZIP_NAME_MDNS}" USBFlux.app
cd "${THISDIR}" || return
zip "${ZIP_NAME_MDNS}" README README.md
# copy domain configuration file
cp domain.conf $SRCDIR/USBFlux.app/Contents/Resources/domain.conf
# resign the app
codesign --force --sign "Developer ID Application: Corellium LLC (XG264R6QP8)" --entitlements USBFlux/build/USBFlux.build/Release/USBFlux.build/USBFlux.app.xcent --requirements "=designated => anchor apple generic and identifier \"\$self.identifier\" and ((cert leaf[field.1.2.840.113635.100.6.1.9] exists) or ( certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and certificate leaf[subject.OU] = \"XG264R6QP8\" ))" --timestamp=none "${SRCDIR}/USBFlux.app"
./create-dmg/create-dmg --volname "USBFlux ${VER}" --volicon USBFlux/VolumeIcon.icns --background USBFlux/background.png --window-size 800 421 --icon-size 128 --icon USBFlux.app 0 0 --icon " " 340 0 --icon USBFlux.pdf 0 200 "${DMG_NAME_API}" "${SRCDIR}"
cd "${SRCDIR}" || return
zip -r "${THISDIR}/${ZIP_NAME_API}" USBFlux.app
cd "${THISDIR}" || return
zip "${ZIP_NAME_API}" README README.md
rm -rf ${SRCDIR}