blob: db637ebcbef8ec7bed5c1024c4c3cc2bd8868b4b (
plain)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
#!/bin/sh
# usage: ./mkdeb-atv2.sh release/debug (case insensitive)
# Allows us to run mkdeb-atv2.sh from anywhere in the three, rather than the tools/darwin/packaging/atv2 folder only
XBMC_DEPENDS_ROOT=@DEPENDS_ROOT_FOR_XCODE@
SWITCH=`echo $1 | tr [A-Z] [a-z]`
DIRNAME=`dirname $0`
DSYM_TARGET_DIR=${XBMC_DEPENDS_ROOT}/dSyms
DSYM_FILENAME=@APP_NAME@.frappliance.dSYM
if [ ${SWITCH:-""} = "debug" ]; then
echo "Packaging Debug target for ATV2"
APP="$DIRNAME/../../../../build/Debug-iphoneos/@APP_NAME@.frappliance"
DSYM="$DIRNAME/../../../../build/Debug-iphoneos/$DSYM_FILENAME"
elif [ ${SWITCH:-""} = "release" ]; then
echo "Packaging Release target for ATV2"
APP="$DIRNAME/../../../../build/Release-iphoneos/@APP_NAME@.frappliance"
DSYM="$DIRNAME/../../../../build/Release-iphoneos/$DSYM_FILENAME"
echo $APP
else
echo "You need to specify the build target"
exit 1
fi
#copy bzip2 of dsym to xbmc-depends install dir
if [ -d $DSYM ]; then
if [ -d $DSYM_TARGET_DIR ]; then
tar -C $DSYM/.. -c $DSYM_FILENAME/ | bzip2 > $DSYM_TARGET_DIR/`$DIRNAME/../gitrev-posix`-${DSYM_FILENAME}.tar.bz2
fi
fi
if [ ! -d $APP ]; then
echo "@APP_NAME@.frappliance not found! are you sure you built $1 target?"
exit 1
fi
if [ -f "$XBMC_DEPENDS_ROOT/buildtools-native/bin/fakeroot" ]; then
SUDO="$XBMC_DEPENDS_ROOT/buildtools-native/bin/fakeroot"
elif [ -f "/usr/libexec/fauxsu/libfauxsu.dylib" ]; then
export DYLD_INSERT_LIBRARIES=/usr/libexec/fauxsu/libfauxsu.dylib
elif [ -f "/usr/bin/sudo" ]; then
SUDO="/usr/bin/sudo"
fi
if [ -f "$XBMC_DEPENDS_ROOT/buildtools-native/bin/dpkg-deb" ]; then
# make sure we pickup our tar, gnutar will fail when dpkg -i
bin_path=$(cd ${XBMC_DEPENDS_ROOT}/buildtools-native/bin; pwd)
export PATH=${bin_path}:${PATH}
fi
PACKAGE=org.xbmc.@APP_NAME_LC@-atv2
VERSION=@APP_VERSION_MAJOR@.@APP_VERSION_MINOR@
REVISION=0~@APP_VERSION_TAG_LC@
ARCHIVE=${PACKAGE}_${VERSION}-${REVISION}_iphoneos-arm.deb
SIZE="$(du -s -k ${APP} | awk '{print $1}')"
echo Creating $PACKAGE package version $VERSION revision $REVISION
${SUDO} rm -rf $DIRNAME/$PACKAGE
${SUDO} rm -rf $DIRNAME/$ARCHIVE
# create debian control file.
mkdir -p $DIRNAME/$PACKAGE/DEBIAN
echo "Package: $PACKAGE" > $DIRNAME/$PACKAGE/DEBIAN/control
echo "Priority: Extra" >> $DIRNAME/$PACKAGE/DEBIAN/control
echo "Name: @APP_NAME@-ATV2" >> $DIRNAME/$PACKAGE/DEBIAN/control
echo "Depends: curl, org.awkwardtv.whitelist, com.nito.updatebegone, org.xbmc.@APP_NAME_LC@-seatbeltunlock" >> $DIRNAME/$PACKAGE/DEBIAN/control
echo "Version: $VERSION-$REVISION" >> $DIRNAME/$PACKAGE/DEBIAN/control
echo "Architecture: iphoneos-arm" >> $DIRNAME/$PACKAGE/DEBIAN/control
echo "Installed-Size: $SIZE" >> $DIRNAME/$PACKAGE/DEBIAN/control
echo "Description: @APP_NAME@ Entertainment Center for AppleTV 2" >> $DIRNAME/$PACKAGE/DEBIAN/control
echo "Homepage: http://kodi.tv/" >> $DIRNAME/$PACKAGE/DEBIAN/control
echo "Maintainer: Memphiz" >> $DIRNAME/$PACKAGE/DEBIAN/control
echo "Author: Team-@APP_NAME@" >> $DIRNAME/$PACKAGE/DEBIAN/control
echo "Section: Multimedia" >> $DIRNAME/$PACKAGE/DEBIAN/control
# prerm: called on remove and upgrade - get rid of existing bits.
echo "#!/bin/sh" > $DIRNAME/$PACKAGE/DEBIAN/prerm
echo "find /Applications/@APP_NAME@.frappliance -delete" >> $DIRNAME/$PACKAGE/DEBIAN/prerm
echo "if [ \"\`uname -r\`\" = \"10.3.1\" ]; then" >> $DIRNAME/$PACKAGE/DEBIAN/prerm
echo " find /Applications/Lowtide.app/Appliances/@APP_NAME@.frappliance -delete" >> $DIRNAME/$PACKAGE/DEBIAN/prerm
echo "else" >> $DIRNAME/$PACKAGE/DEBIAN/prerm
echo " find /Applications/AppleTV.app/Appliances/@APP_NAME@.frappliance -delete" >> $DIRNAME/$PACKAGE/DEBIAN/prerm
echo "fi" >> $DIRNAME/$PACKAGE/DEBIAN/prerm
chmod +x $DIRNAME/$PACKAGE/DEBIAN/prerm
# postinst: symlink @APP_NAME@.frappliance into correct location and reload Lowtide/AppleTV.
echo "#!/bin/sh" > $DIRNAME/$PACKAGE/DEBIAN/postinst
echo "chown -R mobile:mobile /Applications/@APP_NAME@.frappliance" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo "cp /Applications/@APP_NAME@.frappliance/AppIcon.png /Applications/AppleTV.app/com.apple.frontrow.appliance.@APP_NAME_LC@\@720p.png" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo "mkdir -p /private/var/mobile/Library/Caches/AppleTV/MainMenu/" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo "cp /Applications/@APP_NAME@.frappliance/AppIcon.png /private/var/mobile/Library/Caches/AppleTV/MainMenu/com.apple.frontrow.appliance.@APP_NAME_LC@@720.png" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo "cp /Applications/@APP_NAME@.frappliance/AppIcon.png /Applications/@APP_NAME@.frappliance/TopRowIcon.png" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo "if [ \"\`uname -r\`\" = \"10.3.1\" ]; then" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo " ln -sf /Applications/@APP_NAME@.frappliance /Applications/Lowtide.app/Appliances/@APP_NAME@.frappliance" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo " killall Lowtide" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo "else" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo " mkdir -p /Applications/AppleTV.app/Appliances" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo " ln -sf /Applications/@APP_NAME@.frappliance /Applications/AppleTV.app/Appliances/@APP_NAME@.frappliance" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo " killall AppleTV" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo "fi" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo "FILE=/var/mobile/Media/Photos/seas0nTV.png" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo "if [ -f \$FILE ]; then" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo " echo \"File \$FILE exists. removing...\"" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo " rm \$FILE" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
echo "fi" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
cat $DIRNAME/../migrate_to_kodi_ios.sh >> $DIRNAME/$PACKAGE/DEBIAN/postinst
chmod +x $DIRNAME/$PACKAGE/DEBIAN/postinst
# prep @APP_NAME@.frappliance
mkdir -p $DIRNAME/$PACKAGE/Applications
cp -r $APP $DIRNAME/$PACKAGE/Applications/
find $DIRNAME/$PACKAGE/Applications/ -name '.svn' -exec rm -rf {} \;
find $DIRNAME/$PACKAGE/Applications/ -name '.git*' -exec rm -rf {} \;
find $DIRNAME/$PACKAGE/Applications/ -name '.DS_Store' -exec rm -rf {} \;
find $DIRNAME/$PACKAGE/Applications/ -name '*.xcent' -exec rm -rf {} \;
# set ownership to root:root
${SUDO} chown -R 0:0 $DIRNAME/$PACKAGE
echo Packaging $PACKAGE
# Tell tar, pax, etc. on Mac OS X 10.4+ not to archive
# extended attributes (e.g. resource forks) to ._* archive members.
# Also allows archiving and extracting actual ._* files.
export COPYFILE_DISABLE=true
export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
#
${SUDO} dpkg-deb -bZ lzma $DIRNAME/$PACKAGE $DIRNAME/$ARCHIVE
${SUDO} chown 501:20 $DIRNAME/$ARCHIVE
dpkg-deb --info $DIRNAME/$ARCHIVE
dpkg-deb --contents $DIRNAME/$ARCHIVE
# clean up by removing package dir
${SUDO} rm -rf $DIRNAME/$PACKAGE
|