Skip to content

Instantly share code, notes, and snippets.

Created May 15, 2013 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/5583322 to your computer and use it in GitHub Desktop.
Save anonymous/5583322 to your computer and use it in GitHub Desktop.
Script creates .deb package for bittorent sync binary. Usage: 1. Create directory and place script in 2. Exec script with parameters <btsync_version> <debian_arch> <deb_packet_version> Example ./btsync_create_deb.sh 1.0.132 amd64 1 Only i386 and amd64 debian_arch supported right now. 3. ... 4. Profit!
#!/bin/sh
if [ !$1 ] || [ !$2 ] || [ !$3 ] ; then
echo 'Usage: ./btsync_create_deb.sh <btsync_version> <debian_arch> <deb_packet_version>'
exit 1
fi
BT_VERSION=$1
DEB_ARCH=$2
DEB_PACKET_VERSION=$3
case $DEB_ARCH in
amd64)
BT_ARCH="x64"
;;
i386)
BT_ARCH="i386"
;;
esac
DEB_VERSION=$BT_VERSION"-"$DEB_PACKET_VERSION"_"$DEB_ARCH
DEB_PACKET_NAME="btsync_"$DEB_VERSION".deb"
DISTR_NAME="btsync_"$BT_ARCH"-"$BT_VERSION
DISTR_FILE=$DISTR_NAME".tar.gz"
DISTR_LINK="http://syncapp.bittorrent.com/"$BT_VERSION"/"$DISTR_FILE
#download btsync
wget $DISTR_LINK
tar xzvf $DISTR_FILE
DEB_DISTR_NAME="btsync_"$DEB_VERSION
mkdir $DEB_DISTR_NAME
mkdir -p $DEB_DISTR_NAME"/usr/bin"
cp btsync $DEB_DISTR_NAME"/usr/bin"
mkdir -p $DEB_DISTR_NAME"/usr/share/doc/btsync"
cp LICENSE.TXT $DEB_DISTR_NAME"/usr/share/doc/btsync"
mkdir $DEB_DISTR_NAME"/DEBIAN"
cat <<EOF > $DEB_DISTR_NAME"/DEBIAN/control"
Package: btsync
Source: btsync
Version: $BT_VERSION
Architecture: $DEB_ARCH
Maintainer: Dmitry Yudin <public@akademic.name>
Section: net
Priority: optional
Homepage: http://labs.bittorrent.com/experiments/sync.html
Description: BitTorrent Sync synchronizes your files using a peer-to-peer (P2P) protocol.
This protocol is very effective for transferring large files across multiple devices, and is very similar to the powerful protocol used by applications like µTorrent and BitTorrent.
The data is transferred in pieces from each of the syncing devices, and BitTorrent Sync chooses the optimal algorithm to make sure you have a maximum download and upload speed during the process.
EOF
dpkg -b $DEB_DISTR_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment