This Gist will install and configure BitTorrent Sync on a Raspberry Pi running Raspbian. By default, BT Sync will be bound to the address 127.0.0.1
. Meaning the web interface is not accessible from any machine besides the Pi. This script will enable access from any machine on the network.
To perform the default installation of BT Sync, simply execute the following after SSHing onto the Pi.
curl -s -L http://go.trav.sh/pi_btsync | bash
Once installed, simply browse to: http://pi_ip_address:8080
to view the web interface.
#!/usr/bin/env bash
#/etc/init.d/btsync
#
##################################################
# Script to run BitTorrent Sync daemon. By default
# the web UI is not accessible over the LAN due to
# IP address it binds to (127.0.0.1). Therefore
# optional environment variables (noted below) can
# be set to override this behaviour.
##################################################
## Settings
BTSYNC_WEBUI_IP=${BTSYNC_WEBUI_IP:-0.0.0.0}
BTSYNC_WEBUI_PORT=${BTSYNC_WEBUI_PORT:-8080}
## Advanced settings
BTSYNC_OPTIONS=${BTSYNC_OPTIONS:-"--webui.listen $BTSYNC_WEBUI_IP:$BTSYNC_WEBUI_PORT"}
case "$1" in
start)
/usr/local/bin/btsync $BTSYNC_OPTIONS
;;
stop)
killall btsync
;;
*)
echo "Usage: /etc/init.d/btsync {start|stop}"
exit 1
;;
esac
exit 0
#!/usr/bin/env bash
#
###################################################
# Installation and configuration script for BT Sync
###################################################
set -e
## Settings
BASE_GIST_URL=https://gist.githubusercontent.com/tmcinerney/cc8b1fed48fa2c77e921/raw
BTSYNC_SERVICE_NAME=btsync
BTSYNC_SERVICE_FILE=/etc/init.d/$BTSYNC_SERVICE_NAME
BTSYNC_TARBALL_NAME=BitTorrent-Sync_arm.tar.gz
TMP_DIR=/tmp
## Check to see if btsync has already been setup
if [ -f $BTSYNC_SERVICE_FILE ]
then
echo "BT Sync already configured"
exit 0
fi
## Download tarball, extract and move to binary to PATH
echo "Downloading binary"
curl -o $TMP_DIR/$BTSYNC_TARBALL_NAME https://download-cdn.getsyncapp.com/stable/linux-arm/$BTSYNC_TARBALL_NAME
tar -xvf $TMP_DIR/$BTSYNC_TARBALL_NAME -C $TMP_DIR
sudo mv $TMP_DIR/$BTSYNC_SERVICE_NAME /usr/local/bin/$BTSYNC_SERVICE_NAME
sudo chmod +x /usr/local/bin/$BTSYNC_SERVICE_NAME
## Pull service runner file, make it executable add to startup
sudo curl -o $BTSYNC_SERVICE_FILE $BASE_GIST_URL/$BTSYNC_SERVICE_NAME
sudo chmod 755 $BTSYNC_SERVICE_FILE
sudo update-rc.d $BTSYNC_SERVICE_NAME defaults