Lightweight And Unattended Install Of Btsync On Windows.


jameswhite

Recommended Posts

I'm trying to Install Bittorrent Sync on Windows with a powershell script and have it come up, sharing a folder with no interaction.

 

I can install it, but the only way that I can figure out how to put the settings back is to copy 3.21MB of junk in the settings directory back into place. This seems a bit heavy.

 

Is there a way to initialize a new install with just a folder path and key to use? I'd like to be able to initialize the entire application from a gist, with one line of powershell.

 

Something like: 

 

$txt = Resolve-DnsName -name boostrap.wcyd.org -Type TXT; $url = $txt.Text; Invoke-WebRequest "$url" -OutFile "bootstrap.ps1"

 

I can download bittorrent_sync.exe, run it with /PERFORMINSTALL /AUTOMATION

 

If I just copy the settings.dat / sync.dat It gets put into a state where I have to clickey-click the preferences back to the correct key / folder. 

 

I've found some stuff via google about a sync.conf, but all I've been able to do is to get that to get btsync.exe to crash silently.

 

Is there any way to just pass btsync.exe  

  folder: "C:\Users\Me\btsync"; key: "BOBLOBLAWSLAWBLOG"

and have it initialize syncing?

 

Or do I have to copy 3.2MB of folders to get the 2 strings I want out of them?

Link to comment
Share on other sites

This will be a new host, provisioned from an AMI in EC2. I'm basically working with what ships in a naked version of windows, trying to get btsync installed so I can install other tools. I don't have much of a development environment available to me in this case. I guess I could take a stab at using the API from powershell. But I was hoping there would be simpler option than writing code.

Link to comment
Share on other sites

I can't get the API to do anything but return empty responses. I requested an API Key, but I'm not sure what it's for, the documentation you linked seems to only reference "secret" when it means a folder secret and not "secret" when it means an API key.

 

Also the use of [port] is kind of ambiguous. I shut off btsync, ran netstat -an, started btsync, and made API calls against everything that showed up new in state LISTENING, but no joy.

 

\0/

Link to comment
Share on other sites

And with this latest release /PERFORMINSTALL /AUTOMATION no longer works. Amazing. The path to the about:Security_BtSync.exe changed to about:security_Bittorrent_Sync.exe as well. which made my trusted sides automation fall over as well...

 

I guess I should just give up on this. As the command line switches and security paths from upstream seem unstable and undocumented. 

 

I'll have to try another route entirely.

 

Thanks for your help.

Link to comment
Share on other sites

I can't get the API to do anything but return empty responses. I requested an API Key, but I'm not sure what it's for, the documentation you linked seems to only reference "secret" when it means a folder secret and not "secret" when it means an API key.

 

Also the use of [port] is kind of ambiguous. I shut off btsync, ran netstat -an, started btsync, and made API calls against everything that showed up new in state LISTENING, but no joy.

 

You'll need an API key in order to use the API, otherwise the API will simply return empty responses as you've found.

 

If you've requested an API key it may take a few days for your to receive it, as API key requests are manually processed. Please see this post for more information.

Link to comment
Share on other sites

@jameswhite
Try running sync installer with "/S" switch - it will install itself silently. Then, you may kill the process and run it with /config parameter, specifying the folders you need inside config file - which can be the same for all the instances. I'm attaching sample config below.

 

It is not necessary to turn on API when you run Sync with config.

 

{  "device_name": "My Sync Device",  "listening_port" : 0, // 0 - randomize port/* 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/.sync",/* set location of pid file */// "pid_file" : "/var/run/btsync/btsync.pid",/* use UPnP for port mapping */  "use_upnp" : true,/* limits in kB/s. 0 - no limit */  "download_limit" : 0,  "upload_limit" : 0,/* proxy configuration */// "proxy_type" : "socks4", // Valid types: "socks4", "socks5", "http_connect". Any other value means no proxy// "proxy_addr" : "192.168.1.2", // IP address of proxy server.// "proxy_port" : 1080,// "proxy_auth" : false, // Use authentication for proxy. Note: only username/password for socks5 (RFC 1929) is supported, and it is not really secure// "proxy_username" : "user",// "proxy_password" : "password",  "webui" :  {    "listen" : "0.0.0.0:8888" // remove field to disable WebUI/* preset credentials. Use password or password_hash *///  ,"login" : "admin"//  ,"password" : "password"//  ,"password_hash" : "some_hash" // password hash in crypt(3) format//  ,"allow_empty_password" : false // Defaults to true/* ssl configuration *///  ,"force_https" : true // disable http//  ,"ssl_certificate" : "/path/to/cert.pem"//  ,"ssl_private_key" : "/path/to/private.key"/* directory_root path defines where the WebUI Folder browser starts (linux only). Default value is / *///  ,"directory_root" : "/home/user/MySharedFolders/"/* dir_whitelist defines which directories can be shown to user or have folders added (linux only)   relative paths are relative to directory_root setting *///  ,"dir_whitelist" : [ "/home/user/MySharedFolders/personal", "work" ]  }/* !!! 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" :  [    {      "secret" : "MY_SECRET_1", // required field - use --generate-secret in command line to create new secret      "dir" : "/home/user/bittorrent/sync_test", // * required field      "use_relay_server" : true, //  use relay server when direct connection fails      "use_tracker" : true,      "use_dht" : false,      "search_lan" : true,      "use_sync_trash" : true, // enable SyncArchive to store files deleted on remote devices      "overwrite_changes" : false, // restore modified files to original version, ONLY for Read-Only folders      "known_hosts" : // specify hosts to attempt connection without additional search      [        "192.168.1.2:44444"      ]    }  ]*//* Advanced preferences can be added to config file. Info is available at http://sync-help.bittorrent.com */}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.