btstack/package.sh

64 lines
2.5 KiB
Bash
Raw Normal View History

#!/bin/sh
PACKAGE=BTstack
2010-01-23 23:23:16 +00:00
svn update
2010-08-26 20:30:10 +00:00
VERSION=0.2
REVISION=`svn info | grep Revision | cut -d " " -f 2`
ARCHIVE=$PACKAGE-$VERSION-$REVISION.deb
echo Creating $PACKAGE package version $VERSION revision $REVISION
2009-10-29 19:52:37 +00:00
sudo rm -rf $PACKAGE
mkdir -p $PACKAGE/DEBIAN
cp resources/control $PACKAGE/DEBIAN
echo "Version: $VERSION-$REVISION" >> $PACKAGE/DEBIAN/control
mkdir -p $PACKAGE/usr/local/bin
cp src/BTdaemon $PACKAGE/usr/local/bin
2010-06-08 20:53:15 +00:00
cp PatchBlueTool/PatchBlueTool $PACKAGE/usr/local/bin
cp example/inquiry $PACKAGE/usr/local/bin
mkdir -p $PACKAGE/usr/local/lib
cp src/libBTstack.dylib $PACKAGE/usr/local/lib
mkdir -p $PACKAGE/System/Library/CoreServices/SpringBoard.app
cp resources/*.png $PACKAGE/System/Library/CoreServices/SpringBoard.app
mkdir -p $PACKAGE/Library/LaunchDaemons/
cp resources/ch.ringwald.BTstack.plist $PACKAGE/Library/LaunchDaemons/
# prerm: called on remove and upgrade - stop daemon and get rid of BlueToolH4
echo "#!/bin/sh" > $PACKAGE/DEBIAN/prerm
echo "/bin/launchctl unload /Library/LaunchDaemons/ch.ringwald.BTstack.plist 2&> /dev/null" >> $PACKAGE/DEBIAN/prerm
echo "rm -f /usr/local/bin/BlueToolH4" >> $PACKAGE/DEBIAN/prerm
chmod +x $PACKAGE/DEBIAN/prerm
2010-06-09 12:21:51 +00:00
2010-06-09 13:17:39 +00:00
# extrainst_ (cydia only): patch BlueTool and install as /usr/local/bin/BlueToolH4
# note: cannot delete BlueToolH4 in postrm as it would delete the tool just created by extrainst_
2010-06-09 12:21:51 +00:00
echo "#!/bin/sh" > $PACKAGE/DEBIAN/extrainst_
2010-06-09 13:17:39 +00:00
echo "rm -f /tmp/BlueToolH4 /usr/local/bin/BlueToolH4" >> $PACKAGE/DEBIAN/extrainst_
echo "cp /usr/sbin/BlueTool /tmp/BlueToolH4" >> $PACKAGE/DEBIAN/extrainst_
echo "/usr/local/bin/PatchBlueTool /tmp/BlueToolH4 2&> /dev/null" >> $PACKAGE/DEBIAN/extrainst_
echo "ldid -s /tmp/BlueToolH4" >> $PACKAGE/DEBIAN/extrainst_
echo "cp -f /tmp/BlueToolH4 /usr/local/bin" >> $PACKAGE/DEBIAN/extrainst_
echo "rm -f /tmp/BlueToolH4" >> $PACKAGE/DEBIAN/extrainst_
chmod +x $PACKAGE/DEBIAN/extrainst_
2010-06-09 12:21:51 +00:00
# postinst: startup daemon
echo "#!/bin/sh" > $PACKAGE/DEBIAN/postinst
2010-06-09 13:17:39 +00:00
echo "/bin/launchctl load /Library/LaunchDaemons/ch.ringwald.BTstack.plist 2&> /dev/null" >> $PACKAGE/DEBIAN/postinst
chmod +x $PACKAGE/DEBIAN/postinst
2010-06-09 12:21:51 +00:00
# set ownership to root:root
sudo chown -R 0:0 $PACKAGE
echo Packaging $PACKAGE
export COPYFILE_DISABLE
export COPY_EXTENDED_ATTRIBUTES_DISABLE
dpkg-deb -b $PACKAGE $ARCHIVE
dpkg-deb --info $ARCHIVE
dpkg-deb --contents $ARCHIVE