forked from powenn/permasigneriOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuildDebForTest.command
executable file
·73 lines (53 loc) · 2.01 KB
/
BuildDebForTest.command
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
#!/bin/bash
set -e
cd "$(dirname "$0")"
WORKING_LOCATION="$(pwd)"
APPLICATION_NAME="permasigneriOS"
TIMESTAMP="$(date +%s)"
rm -rf build *.deb || true
mkdir build
cd build
rm -rf dpkg || true
mkdir dpkg
echo "[*] starting build..."
xcodebuild -project "$WORKING_LOCATION/$APPLICATION_NAME.xcodeproj" \
-scheme "$APPLICATION_NAME" \
-configuration Release \
-derivedDataPath "$WORKING_LOCATION/build/DerivedDataApp" \
-destination 'generic/platform=iOS' \
clean build \
ONLY_ACTIVE_ARCH="NO" \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" \
# copy .app out of DerivedData
DD_APP_PATH="$WORKING_LOCATION/build/DerivedDataApp/Build/Products/Release-iphoneos/$APPLICATION_NAME.app"
TARGET_APP="$WORKING_LOCATION/build/$APPLICATION_NAME.app"
cp -r "$DD_APP_PATH" "$TARGET_APP"
# clean the app
codesign --remove "$TARGET_APP"
if [ -e "$TARGET_APP/_CodeSignature" ]; then
rm -rf "$TARGET_APP/_CodeSignature"
fi
if [ -e "$TARGET_APP/embedded.mobileprovision" ]; then
rm -rf "$TARGET_APP/embedded.mobileprovision"
fi
# make our sign
ldid -S"$WORKING_LOCATION/Entitlements.plist" "$TARGET_APP/$APPLICATION_NAME"
CONTROL_VERSION="$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "$TARGET_APP/Info.plist")"
BUILD_VERSION="$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$TARGET_APP/Info.plist")"
echo "[*] preparing package layout..."
# make dpkg layer
cd "$WORKING_LOCATION/build/dpkg"
mkdir ./Applications
cp -r "$TARGET_APP" ./Applications/
cp -r "$WORKING_LOCATION/DEBIAN" ./
sed -i '' "s/@@VERSION@@/$CONTROL_VERSION.$BUILD_VERSION-TEST/g" ./DEBIAN/control
# fix permission
cd "$WORKING_LOCATION/build/dpkg"
chmod -R 0755 DEBIAN
echo "[*] packaging..."
cd "$WORKING_LOCATION/build/dpkg"
PKG_NAME="com.powen.permasignerios.$CONTROL_VERSION.$BUILD_VERSION-$TIMESTAMP.deb"
dpkg-deb -b . "../$PKG_NAME"
mv "$WORKING_LOCATION/build/$PKG_NAME" "$WORKING_LOCATION/$PKG_NAME"
# print done
echo "Package is at $WORKING_LOCATION/$PKG_NAME"