-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild_deb.sh
executable file
·71 lines (57 loc) · 1.8 KB
/
build_deb.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
#!/bin/bash
# This builds a .deb package for installing MobileTerminal using
# Cydia as described here: http://www.saurik.com/id/7
#
# This script is executed by the "deb" XCode target.
set -e
set -u
PATH=$PATH:/usr/local/bin
if [ ! `which dpkg-deb` ]; then
echo "Could not find dpkg-deb command to build package";
exit 1
fi
APP_NAME=Terminal
PACKAGE_NAME=MobileTerminal
CONTROL_FILE=control.def
ARCH=iphoneos-arm
if [ ${DEB_VERSION-_} ]; then
DEB_VERSION=1
fi
SVN_VERSION=`svnversion $SRCROOT | sed 's/^.*://'`
# The directory where the .deb file is being packaged
DEB_BUILD_DIR=$DERIVED_FILE_DIR/$PACKAGE_NAME
DEB_METADATA_DIR=$DEB_BUILD_DIR/DEBIAN
DEB_APP_DIR=$DEB_BUILD_DIR/Applications
while [ true ]; do
# This is the .deb package version, put in the control file and deb filename.
VERSION="$SVN_VERSION-$DEB_VERSION"
DEB_DST=$TARGET_BUILD_DIR/${PACKAGE_NAME}_${VERSION}_${ARCH}.deb
if [ ! -f $DEB_DST ]; then
break
fi
DEB_VERSION=$((DEB_VERSION + 1))
done
if [ ${1-_} == "clean" ]; then
rm -fr $TARGET_BUILD_DIR/${PACKAGE_NAME}*
rm -fr $DEB_BUILD_DIR
exit 0
fi
echo "Building $DEB_DST"
# Make sure the iPhone app has already been built
APPLICATION_DIR=$BUILT_PRODUCTS_DIR/$APP_NAME.app
if [ ! -d $APPLICATION_DIR ]; then
echo "Application directory does not exist: $APPLICATION_DIR";
exit 1
fi
APPLICATION_SIZE=`du -s -k $APPLICATION_DIR | awk '{ print $1 }'`
# Build the .deb metadata
mkdir -p $DEB_METADATA_DIR
grep -v "^#" $SRCROOT/control.def | sed "s/VERSION/$VERSION/" | sed "s/SIZE/$APPLICATION_SIZE/" | sed "s/ARCH/$ARCH/" > $DEB_METADATA_DIR/control
# Copy the actual application
mkdir -p $DEB_APP_DIR
cp -rp $APPLICATION_DIR $DEB_APP_DIR/
# Don't copy OS X metadata files
export COPYFILE_DISABLE
export COPY_EXTENDED_ATTRIBUTES_DISABLE
dpkg-deb --build $DEB_BUILD_DIR $DEB_DST
exit 0