Skip to content

Instantly share code, notes, and snippets.

@codekoala
Last active December 17, 2015 15:08
Show Gist options
  • Save codekoala/5629059 to your computer and use it in GitHub Desktop.
Save codekoala/5629059 to your computer and use it in GitHub Desktop.
Customized PKGBUILD for btsync with user-specific profiles
{
"device_name": "BTSync Client on Arch Linux",
// 0 - randomize port
"listening_port": 0,
/**
storage_path dir contains auxilliary app files
if no storage_path field: .sync dir created in the directory
where binary is located.
otherwise user-defined directory will be used
*/
"storage_path": "/var/btsync",
// uncomment next line if you want to set location of pid file
"pid_file": "/run/btsync.pid",
"check_for_updates" : false,
"use_upnp": true, // use UPnP for port mapping
/* limits in kB/s
0 - no limit
*/
"download_limit": 0,
"upload_limit": 0,
/* remove "listen" field to disable WebUI
remove "login" and "password" fields to disable credentials check
*/
"webui": {
"listen": "0.0.0.0:8888",
"login": "admin",
"password": "password"
}
/*
!!! if you set shared folders in config file WebUI will be DISABLED !!!
shared directories specified in config file
override the folders previously added from WebUI.
*/
/*
,
"shared_folders": [
{
// use --generate-secret in command line to create new secret
"secret": "MY_SECRET_1", // * required field
"dir": "/home/user/bittorrent/sync_test", // * required field
// use relay server when direct connection fails
"use_relay_server": true,
"use_tracker": true,
"use_dht": false,
"search_lan": true,
// enable sync trash to store files deleted on remote devices
"use_sync_trash": true,
// specify hosts to attempt connection without additional search
"known_hosts": [
"192.168.1.2:44444",
"myhost.com:6881"
]
}
]
*/
// Advanced preferences can be added to config file.
// Info is available in BitTorrent Sync User Guide.
}
[Unit]
Description=BTSync
After=network.target
[Service]
User=root
ExecStart=/usr/share/btsync/btsync --config /etc/btsync/btsync.json --nodaemon
[Install]
WantedBy=multi-user.target
/**
* User-specific BTSync configuration.
*
* Helps to set ownership to someone other than root for files that are copied
* with btsync. Copy this file to ~/.btsync/settings.json for the user you wish
* to configure btsync as:
*
* mkdir -p ~/.btsync
* cp /etc/btsync/[email protected] ~/.btsync/settings.json
*
* Replace user-specific references with the appropriate information, including
* the following settings:
*
* - storage_path
* - pid_file
* - webui.listen
* - webui.login
* - webui.password
*
* Then start btsync:
*
* systemctl start btsync@user
*
* where `user` is your username.
**/
{
"device_name": "BTSync Client For User on Arch Linux",
// 0 - randomize port
"listening_port": 0,
/**
storage_path dir contains auxilliary app files
if no storage_path field: .sync dir created in the directory
where binary is located.
otherwise user-defined directory will be used
*/
"storage_path": "/home/user/.btsync",
// uncomment next line if you want to set location of pid file
"pid_file": "/tmp/btsync.user.pid",
"check_for_updates" : false,
"use_upnp": true, // use UPnP for port mapping
/* limits in kB/s
0 - no limit
*/
"download_limit": 0,
"upload_limit": 0,
/* remove "listen" field to disable WebUI
remove "login" and "password" fields to disable credentials check
*/
"webui": {
"listen": "0.0.0.0:8888",
"login": "admin",
"password": "password"
}
/*
!!! if you set shared folders in config file WebUI will be DISABLED !!!
shared directories specified in config file
override the folders previously added from WebUI.
*/
/*
,
"shared_folders": [
{
// use --generate-secret in command line to create new secret
"secret": "MY_SECRET_1", // * required field
"dir": "/home/user/bittorrent/sync_test", // * required field
// use relay server when direct connection fails
"use_relay_server": true,
"use_tracker": true,
"use_dht": false,
"search_lan": true,
// enable sync trash to store files deleted on remote devices
"use_sync_trash": true,
// specify hosts to attempt connection without additional search
"known_hosts": [
"192.168.1.2:44444",
"myhost.com:6881"
]
}
]
*/
// Advanced preferences can be added to config file.
// Info is available in BitTorrent Sync User Guide.
}
[Unit]
Description=BTSync for %i
After=network.target
[Service]
User=%i
ExecStart=/usr/share/btsync/btsync --config /home/%i/.btsync/settings.json --nodaemon
[Install]
WantedBy=multi-user.target
# Maintainer: Dongsheng Cai <http://dongsheng.org>
# Maintainer: ava1ar < mail(at)ava1ar(dot)info >
pkgname=btsync
pkgver=1.0.134
pkgrel=4
pkgdesc="Automatically sync files via secure, distributed technology"
license=("custom")
arch=('i686' 'x86_64')
url="http://labs.bittorrent.com/experiments/sync.html"
_arch='x64'
[ "$CARCH" = 'i686' ] && _arch='i386'
source=(
http://btsync.s3-website-us-east-1.amazonaws.com/${pkgname}_${_arch}.tar.gz
btsync.service
[email protected]
btsync.json
[email protected]
)
backup=('etc/btsync/btsync.json')
sha1sums=('fcaa7400e2af5d1285a672bc6ddd3e0945becf08'
'0b54992ed7f819b1700586b80c4a1949d40bb7eb'
'2601e01e6c97e80a86b3be892502ed0579388eaf'
'd23211850e04f04b9ad4fcef8cfc802cf9418c98'
'9f7eda5fc3eec16b8fb6d7a9bc0c80bac0a24331')
[ "$CARCH" = 'i686' ] && sha1sums[0]='273b066ab71678602445a72539f9fe031efd061e'
package() {
install -dm755 "${pkgdir}/var/btsync"
cd "${srcdir}"
install -Dm755 btsync "${pkgdir}/usr/share/btsync/btsync"
install -Dm644 btsync.json "${pkgdir}/etc/btsync/btsync.json"
install -Dm644 [email protected] "${pkgdir}/etc/btsync/[email protected]"
# install systemd script
install -Dm644 btsync.service "$pkgdir/usr/lib/systemd/system/btsync.service"
install -Dm644 [email protected] "$pkgdir/usr/lib/systemd/system/[email protected]"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment