| doc | add CLI options to disable/enable sync pairs for specific run | |
| .gitignore | initial check-in of the "early bird" | |
| _adbsync | add Bash auto-completion | |
| adbsync | add CLI options to disable/enable sync pairs for specific run | |
| LICENSE | initial check-in of the "early bird" | |
| README.md | add Bash auto-completion | |
adbsync
As I was tired of having umpteen separate apps on each device for rare tasks, and especially as I could not find a proper one for syncing with my own resources without setting up stuff on all ends, I decided to create myself this little tool.
adbsync requires no app counter-part on the Android device(s). On the Linux end it utilizes a few tools, which I already used for different other purposes, to achieve the goal of getting a few things synced between my Android device and my computer. You might not have them installed yet, so let me give you the list:
Requirements
- Android's ADB tools. These can e.g. be installed via your distributions packaging system (
android-tools-adbor simplyadb), dragging in several dependencies – or by downloading my minimal package from here. - adbfs is used to mount your Android device via ADB, so it shows up in your computer's local file system. This is not only useful for adbsync but also makes it easy to access your device's files from your PC.
- the
jqbinary to parse your JSON configuration. On Linux, it usually comes via your distribution's package repo asjq. - Developer options and USB Debugging enabled on your Android device.
- an empty directory to mount your Android device to.
- a JSON configuration file telling
adbsyncwhat to sync and how. An example JSON (plus one with some comments on it – JSON does not support comments) can be found in thedoc/sub-directory here in this very Git repo.
Instructions
For now just a few simple hints, I might add some more detailed instructions later:
- prepare an empty directory to mount your Android device to.
- copy the example
doc/devices.jsonand edit the copy to your needs. You can then pass this "SPECFILE" (or "settings file") toadbsyncvia the-scommand-line parameter; if not specified adbsync will look for for adevices.jsonfirst in the current working directory, if none found there then in$HOME/.config/adbsync/– and complain loudly if it cannot find any. - run
./adbsync -hto get some simple help and see how to call the script. Optionally, placeadbsyncsomewhere in your$PATHto have it accessible from everywhere. - consider performing your first runs in
DRYRUNmode (pass the-doption to the script) to first get a feeling what the script will do. In this mode, no changes are perfomed – instead actions are logged to the screen, including the commands otherwise executed. If that looks fine to you, run adbsync without the-doption to have it really do its job.
Auto-Completion
For command auto-completion with Bash (might work with other shells as well but was not tested by me), you can source the included _adbsync file (see bash-completion for details). This would happen automatically if you place _adbsync into /etc/bash_completion.d and, according to the project documentation, should also work when placed into ~/.local/share/bash_completion.d/completions/. The latter did not work for me (with bash-completion v2.10), though; so I added the following to my ~/.bash_completion:
export BASH_COMPLETION_USER_DIR=$HOME/.local/share/bash_completion.d
for f in ${BASH_COMPLETION_USER_DIR}/completions/*; do
[[ -f "$f" ]] && . "$f"
done
DISCLAIMER
Use this at your own risk. I will not be liable for any damages etc (see the license) and take or give no warranties – except that it will consume a little disk-space when checked out... That said, I'm using it here regularly with multiple devices and it's working fine for me.
LICENSE
As indicated by the included LICENSE file, this little script is protected by the GNU Public License GPLv2.