[TRICK] Pause the repo sync - Android Software/Hacking General [Developers Only]

Hello World!!
Lost the connectivity when syncing a repo source and had to redownload the entire source again?
Not needed anymore!
Well, many of the developers face this problem!
I am here to provide a solution which I found out myself in my experience that you can actually pause the syncing for a while and continue working on it later.
You can also correct the errors that occured during syncing!!
So now lets get our hands dirty. Its a very simple trick.
If you want to pause the repo sync for a while and resume it later time of the day, press "CTRL + Z" and to resume the sync, type "fg" and press enter.
If you want to switch off computer and do the sync tomorrow,
Press "CTRL + Z" and Switch off computer. Then tomorrow or the day you start working, open terminal and change directories to that place where you started syncing and type "repo sync". You need not initialize it again as it has already been done when you have started the sync.
Or if you want to solve the errors in the source that you have just downloaded,
Open terminal and change directories to that place where you started syncing and type "repo sync -f".
These things are also published on xda but as a comment. To make it easier for developers, I am giving this as a trick. Everything is tested by myself.

Thank you for this sharing,
But I have a problem,
I live in IRAN and "GitHub" denies giving service to my country,
therefore I have to use a proxy. But the problem is VPN and Proxies can not cover git,
so I used https://github.com/... instead of git://github.com/..., repo syncs on this situation,
but it doesn't do it properly and can't parse packages due to manifests,
I mean all of source remain in ".repo" folder.
Is there any other way to download the source?

the_pirate_predator said:
Hello World!!
Lost the connectivity when syncing a repo source and had to redownload the entire source again?
Not needed anymore!
Well, many of the developers face this problem!
I am here to provide a solution which I found out myself in my experience that you can actually pause the syncing for a while and continue working on it later.
You can also correct the errors that occured during syncing!!
So now lets get our hands dirty. Its a very simple trick.
If you want to pause the repo sync for a while and resume it later time of the day, press "CTRL + Z" and to resume the sync, type "fg" and press enter.
If you want to switch off computer and do the sync tomorrow,
Press "CTRL + Z" and Switch off computer. Then tomorrow or the day you start working, open terminal and change directories to that place where you started syncing and type "repo sync". You need not initialize it again as it has already been done when you have started the sync.
Or if you want to solve the errors in the source that you have just downloaded,
Open terminal and change directories to that place where you started syncing and type "repo sync -f".
These things are also published on xda but as a comment. To make it easier for developers, I am giving this as a trick. Everything is tested by myself.
Click to expand...
Click to collapse
cool bro!!!!
thank you very much for sharing that!

Awesome.. btw does using http instead of git:// wont cause any problem right?

i have a doubt--> got error that is "Exited sync due to fetch errors". if i do repo sync -f again then syncing will start from 0 or where its left.

Related

[App] rsync backup for Android

I just wanted you to inform you about my first Android application: rsync backup for Android. It is available in Market (for free, ad-supported).
Comments, suggestions, feature requests and bug reports are welcomed.
Just curious about your instructions.... You mention generating keys multiple times, but not sure why?
Typically to use ssh keys, one must generate keys on the client, transfer the public key of the client to the server. Then the client can connect into the server using the certificate rather than passphrase authentication.
Your instructions confused me.. It could be due to not having coffee yet, but might want to streamline the info a bit or users might never get to actually using it.
I'll try it myself later, as I already do this but curious how you've done it on your end. Here's what I run manually about once a week from GScript:
rsync -rltDv --delete --chmod=u=rwX,g=rX,o=rX --exclude=".android_secure" --exclude "Music" -e "sshfixed -l user -y -i /sdcard/bin/etc/dropbear/dropbear_dss_host_key" /mnt/sdcard [email protected]:/media3/android/microsd/rsync-backup/hourly.0/
Click to expand...
Click to collapse
And the server itself does a hard-link copy and move of directory names etc which maintains a set of 4 snapshots, I also do the same thing for my backups on the machines themselves.. Handy to find stuff I just realized I hosed a month ago..
Biggest annoyance was having to dupliate ssh (dropbear) and fix it so it uses /dev/urandom, as /dev/random isn't a viable source for ssh.
These are three different ways of generating private+public key pair. I'll add some description, because it could be confusing, as you said.
_sammael_ said:
These are three different ways of generating private+public key pair. I'll add some description, because it could be confusing, as you said.
Click to expand...
Click to collapse
Ah, yes that makes more sense, give them options on how to generate the keys.. However, you can only create keys on the client itself, one mention seemed like it was referring to using a Linux box to create them?
You can always generate keys on Linux box, then transfer private key to your Android and append public key to authorized_keys.
_sammael_ said:
You can always generate keys on Linux box, then transfer private key to your Android and append public key to authorized_keys.
Click to expand...
Click to collapse
To connect from Linux to Android... Yes. But pretty sure that won't work for Android to Linux, which is what I'd think you'd normally do?
He's saying, move both keys. Generally the private key is left on the system that generated it, but that doesn't need to be the case. At least as far as I know.
First off, brilliant app! It's exactly what I have been looking for to save me a huge amount of time and effort. Currently I was doing this by hand because I've had bad experiences with sdcards suddenly just stop working meaning I loose everything.
I have set a range of profiles up and had Tasker kick them off daily however I am at a loss how to get --exclude-from '/sdcard/excludefile.txt' working. When ever I run a profile it states:
rsync: failed to open exclude file '/sdcard/excludefile.txt' : No such file or directory (2)
rsync error : error in file IO (code 11) at exclude.c(1062) [client=3.0.6]
Click to expand...
Click to collapse
What I'm wanting to do is have the following profiles
/ -> /home/user/mobile/dellstreak/
[exclude sdcard exclude*]
/sdcard -> /home/user/mobile/dellstreak/sdcard
[exclude DCIM audio ebooks video media rings downloads temp exclude*]
/sdcard/DCIM -> /home/user/mobile/dellstreak/sdcard/DCIM
Click to expand...
Click to collapse
You can see what I'm wanting to do, I want a little more control over some profiles i.e. so I can backup DCIM whilst out and about or back up the sdcard without backing up all my music, videos etc.
Any help would be appreciated.
Try filename without the quotes:
--exclude-from /sdcard/excludefile.txt
Currently custom parameters parser takes arguments literally. Splitting is done using space as a delimited. That's why spaces in filenames won't work and rsync think that your filename is '/sdcard/excludefile.txt' (file excludefile.txt' in directory '/sdcard) instead of /sdcard/excludefile.txt
khaytsus said:
To connect from Linux to Android... Yes. But pretty sure that won't work for Android to Linux, which is what I'd think you'd normally do?
Click to expand...
Click to collapse
Yes, it will work. If you don't believe me, check it for yourself. In fact I initially generated my private key on my Linux box (using dropbearkey), then tested method with dropbearconvert.
Please notice that what you're generating is key pair, which means that it will work as long as you put public key in remote side's authorized_keys (no matter what system it is and where it was generated) and authenticate using corresponding private key.
Been using it for weeks now, I love it.
You should document a few things, such as how to create a dropbear key from a standard key.
Confirmation number: 9X233376XY8982101.
It is documented on application's webpage (see Menu -> Help).
_sammael_ said:
It is documented on application's webpage (see Menu -> Help).
Click to expand...
Click to collapse
So it is. I'm not sure if that was there when I first started using, but you've added the things I would have suggested (being able to change the command line options, etc.)
_sammael_ said:
Try filename without the quotes:
--exclude-from /sdcard/excludefile.txt
Currently custom parameters parser takes arguments literally. Splitting is done using space as a delimited. That's why spaces in filenames won't work and rsync think that your filename is '/sdcard/excludefile.txt' (file excludefile.txt' in directory '/sdcard) instead of /sdcard/excludefile.txt
Click to expand...
Click to collapse
The exclude files I'm parsing don't have spaces in anyway so luckily I didn't have to worry about that (coming from a linux background has taught me to avoid spaces where ever possible, not to mention keep everything lower case )
Your suggestion of removing the quotes (') seems to have done it, I use rsync on my linux boxes which require you to use quotes when parsing an exclude file.
Will check that it's parsing the exclude files correctly and will report back.
As per documentation that someone has suggested, I found the current documentation to work find, however it seems a little sparse. Maybe creating a wiki site for the documentation might help with this?
Again thankyou for a great app.
The exclude list seems to be working as expected, I now have it syncing as follows
/ -> /home/user/mobile/dellstreak/sdcard
/sdcard -> /home/user/mobile/dellstreak/sdcard
/sdcard/DCIM -> /home/user/mobile/dellstreak/sdcard/DCIM
Click to expand...
Click to collapse
I've also significantly increased my excludes to cover directories that have permission issues or that are (re)created on boot.
##rsyncrootexclude##
/sdcard
/acct
/cache
/config
/d
/mnt
/proc
/dev
/sys
Click to expand...
Click to collapse
##rsyncsdcardexclude##
/sdcard/Update*.zip
/sdcard/update*.zip
/sdcard/video
/sdcard/audio
/sdcard/ebooks
/sdcard/download
/sdcard/media/music
/sdcard/music
/sdcard/xuluan.podcast
Click to expand...
Click to collapse
So one suggestion, is it possible to add a scheduler to this?
I use Titanium Backup to make backups of my apps/data daily and would like that pushed automatically to my rsync server.
I didn't plan to add this, you can use Tasker or Locale.
As _sammael_ says, tasker works great with it.
I get it to automagically rsync when ever I connect to my wifi, and then on a timed scheduled.
ssh required?
great app.. like others, I was using rsync manually.
Do you only support rsync over ssh? I currently use the (insecure) rsync protocol to sync a "TV" folder on my Windows Media Center box. I can install a SSH server, it just seems overkill for my needs.
Robert
Currently only rsync over ssh is supported, but I guess I can add selection whether user want to use ssh or not. Am I thinking correctly that it will be as simple as skipping rsync's -e option?

acidify questions

alright maybe im going at this the wrong way i want to be a dev... well i try and get acidify well im getting all kinda errors when i do the command acidify infi cm9
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
warning: https unexpectedly said: '0000'
error: '/home/lee/.repo/projects/external/bluetooth/bluez.git/clone.bundle' does not look like a v2 bundle file
fatal: Could not read bundle '/home/lee/.repo/projects/external/bluetooth/bluez.git/clone.bundle'.
what does this mean i wanna learn about this stuff but keep getting these errors
Likely a server timeout or other glitch. "repo sync" until you don't have any more errors. The first time sync is painful.
Posted from my AOKP-ified SGS4G
It went on for about three hours and kept on doing the same thing anything I can do
Sent from my superchager SGH-T959V using xda app-developers app
Delete the damaged file and restart the sync. Hopefully it will finish. Expect a full sync to take 5-20 tries, and if you ever abort due to being bored or just having a lousy network connection... your fun may increase exponentially.
Question of my own... on both Windows with Cygwin as well as on Ubuntu with all the 'standard' requested packages, I get this error when trying to run Acidify 0.4.0:
# ./acidify
./acidify: line 8: color: command not found
Click to expand...
Click to collapse
Am I just missing some incredibly obvious package? I've compiled kernels manually, but Acidify sounds like it should make things a ton easier. Thanks.
Color should be a built in function of the script. I hope max sees this post since I can't look into it right now
Ahh... the function color is included, lines 196-222... but it's first used on line 8, as well as 61. THEN it gets defined.
Unless it gets put into bashrc like in this AskUbuntu example, I think it needs to be defined before it gets used.
Theraze said:
Ahh... the function color is included, lines 196-222... but it's first used on line 8, as well as 61. THEN it gets defined.
Unless it gets put into bashrc like in this AskUbuntu example, I think it needs to be defined before it gets used.
Click to expand...
Click to collapse
Maybe post a bug report on github? m4xm4n has been busy with school. This will insure he sees it.
Moved the color() function from 196-222 to line 5. Acidify now runs... well, it gives me a new error. With yellow text!
# ./acidify
Warning: Could not load configuration file. Using environmental or program defaults.
./acidify: line 170: conditional binary operator expected
Click to expand...
Click to collapse
which happens to be the same error I got when manually stripping out the color calls before. That line is:
Code:
[[ -v DISTRIB_ID ]] || DISTRIB_ID="Your system"
I'll try to make a bug report with a note that moving color function fixes my initial glitch.
I'd checkout (as in "git checkout") the previous version if you are continuing to have problems.
Sounds good. Though turning that line into
Code:
DISTRIB_ID="Your system"
made it run on my Cygwin box. Looks like that line is supposed to tell you which specific *nix version isn't supported if it fails, and for some reason on both my Cygwin system and Ubuntu systems, the fail-check fails. However, that appears to have been in the prior versions of Acidify as well, so they appear less likely to be a logical fail-point. Will try it with the checkout though on the Ubuntu.
Edit: And... Cygwin is 32-bit only. Awesome. So it's not going to be running Acidify for me. Ubuntu box is currently processing something else, so I'll check it whenever it decides to move along.
But git checkout left me with the same color error, if that's what was supposed to fix it.
Edit2: Ubuntu box didn't fail on the same spot, so it looks like I'm good... Well, unless it doesn't actually run, but it gets me to the info screen at least. I'll update if it has problems, but it looks like the only other 'issue' I found was Cygwin-only which doesn't really matter for us since it can't run Acidify anyways (being 32-bit). Should I still note it as an issue on Github, or do we not care since it's only an error where it can't possibly work anyways?
Edit3: Okay... One sudo mkdir /.acidify and a sudo mkdir /.repo later and it's actually pulling files down...
reclamer said:
error: '/home/lee/.repo/projects/external/bluetooth/bluez.git/clone.bundle' does not look like a v2 bundle file
fatal: Could not read bundle '/home/lee/.repo/projects/external/bluetooth/bluez.git/clone.bundle'.
Click to expand...
Click to collapse
Poking around in repo to resolve a problem that I have with AOKP right now, I found, from repo help sync
Code:
The --no-clone-bundle option disables any attempt to use
$URL/clone.bundle to bootstrap a new Git repository from a resumeable
bundle file on a content delivery network. This may be necessary if
there are problems with the local Python HTTP client or proxy
configuration, but the Git binary works.
A little note... apparently the error I mentioned comes up anytime you're using a distrib that doesn't show up in the search. Since in addition to Cygwin, that error also comes up when trying to use Acidify with Ubuntu 10.10. Guessing that means that the || bit isn't functioning properly... maybe it needs to be inside the [[]] or something? Guess I should report that as another issue on the tracker.

A Parallel Appstore for WIndows 8/RT for ported Apps and Re-Compiled Apps

Hi Team,
I would like to donate a hosting for a parallel appstore. Please send a msg, I will give you the cpanel username and password. Also, this might be time to think of a domain name I can register one for you. Cheers.
DarkZ
darkstarz said:
Hi Team,
I would like to donate a hosting for a parallel appstore. Please send a msg, I will give you the cpanel username and password. Also, this might be time to think of a domain name I can register one for you. Cheers.
DarkZ
Click to expand...
Click to collapse
pls see this post...
http://forum.xda-developers.com/showpost.php?p=36670567&postcount=19
I think it would be best if we have just one app store, but multiple servers. that way we can standardize distro formats etc and its easy for devs and users.
im working on a tool to package apps in the format for rtdstore and then I shall update the store to handle multiple repos.
while I have no use for the server u are offering as I have my own server, hopefully someone else will be able to use it for an alternative repo
djboo said:
pls see this post...
http://forum.xda-developers.com/showpost.php?p=36670567&postcount=19
I think it would be best if we have just one app store, but multiple servers. that way we can standardize distro formats etc and its easy for devs and users.
im working on a tool to package apps in the format for rtdstore and then I shall update the store to handle multiple repos.
while I have no use for the server u are offering as I have my own server, hopefully someone else will be able to use it for an alternative repo
Click to expand...
Click to collapse
No offense, but we need to get a standardized protocol for talking to and from the servers drafted and going before we get tools designed to use it.
The enthusiasm is good, but you're going about it the wrong way.
netham45 said:
No offense, but we need to get a standardized protocol for talking to and from the servers drafted and going before we get tools designed to use it.
The enthusiasm is good, but you're going about it the wrong way.
Click to expand...
Click to collapse
None taken, but I think you've misunderstood. I've already designed a protocol for option C. My plan is to use flat files for 90% of everything, and the places where its not static, the possibility to use a dos batch file to 'update' the repo on changes, allowing people to use dropbox to host a repo, or use a php/asp script for people with better hosting. The thought process around this is that it means a dev can host a repo just for their app without having to own a server, but people who want to contribute more have the ability for it to be a bit more automatic.
My only flaws at the moment are what to do when more than one repo has the same app (how will updates be managed etc) and how to avoid conflicts (when two repos have an app with the same name but its not the same thing) - both of which will probably be managed with a simple GUID - hense the packager i am working on - making the apps GUID available without the client having to download the app.
Main reason why I want to update the app before sharing all this publicly is that i dont want to share it till i know it works
djboo said:
None taken, but I think you've misunderstood. I've already designed a protocol for option C. My plan is to use flat files for 90% of everything, and the places where its not static, the possibility to use a dos batch file to 'update' the repo on changes, allowing people to use dropbox to host a repo, or use a php/asp script for people with better hosting. The thought process around this is that it means a dev can host a repo just for their app without having to own a server, but people who want to contribute more have the ability for it to be a bit more automatic.
My only flaws at the moment are what to do when more than one repo has the same app (how will updates be managed etc) and how to avoid conflicts (when two repos have an app with the same name but its not the same thing) - both of which will probably be managed with a simple GUID - hense the packager i am working on - making the apps GUID available without the client having to download the app.
Main reason why I want to update the app before sharing all this publicly is that i dont want to share it till i know it works
Click to expand...
Click to collapse
I'd share it before you code it to make sure it'll all work, personally.
As far as the repo list goes, are you planning on hosting a list of default repos that users just change, or are you expecting everyone to enter every repo manually?
netham45 said:
I'd share it before you code it to make sure it'll all work, personally.
As far as the repo list goes, are you planning on hosting a list of default repos that users just change, or are you expecting everyone to enter every repo manually?
Click to expand...
Click to collapse
I'm aiming for both. That way a repo can announce his repo once he has something to show without waiting for me to add it, but I have the control to only add repos that are trusted.
the crux of the repo format is thus:
a single XML file that lists all of the apps on a repo - contains core details like app name, version number, guid etc. These details are extracted from the packaged files - I will supply an EXE that can construct these XML files - and later will also supply a PHP file (I'm currently using asp.classic out of habbit despite being a c# coder - but PHP makes more sense because just about every web server ever supports PHP)
All of the packages will go in the same folder as the XML. The Exe/PHP will also produce text files for each package that includes the further details about the app. This is to keep the primary XML smaller as this will need to be updated by the client app for each repo on start up. I'm consindering having the XML as a zip file to reduce server load too.
As for the package format, Its going to be an XML and ZIP file bundled together, simple toc stuff - create XML, read its size, create new file, first 4 bytes are the XML size, then the XML file, then the ZIP of the package bundled together. This will then have a custom extension which can be associated to an installer app (the Store app obviously will support the format too - and not require an installer)
The installer will be able to be used standalone - but wont be aware of the store at all - meaning it wont update the current installed apps.
Image of package creator:
http://i.imgur.com/Tpaq9.png
Hopefully, you can see that the repo is totally dependant on the package format working. Once the core options work, since its all XML it should be extendable, but without those basics, its not going anywhere.
However, once the repo format is sorted, and the source for the installer is done (and shared) - my store app need not be the only one, no reason why other people who want to write a store cant use this format - last thing i want is 20 different repo/installer formats.
Sounds good enough. The only thing I have to mention is that if the server supports gzip output and your client can handle gzip input the compression of the .xml files is pointless.
And, are you planning on employing any sort of PGP verification methods? It'd be nice.
I can provide a server which is located in HK if need. Thanks all.
Sent from my GT-N7105 using Tapatalk 2

[SCRIPT] Get an Email when Your Computer Finishes Compiling Your ROM

Tired of checking back on your computer to see if your ROM compile is done, only to find out it isn't?? Or even worse, tired of coming back 4 hours after you started your compile, only to find out the darn thing failed 10 min in because you misspelled one word??
I decided to write a simple script that will email you when the compile finishes, it will include the time it took to compile and the last six lines of the output log (so you can see if the error if it had one). I wanted this script to require little, so it uses Gmail as the smtp relay, so you don't need a email server running for this to work. I've been using it for a day now and it's very handy. I may add more features later, we'll see. It needs two dependencies, msmtp and ca-certificates. The install script will install them for you if running Debian or Ubuntu. Otherwise install them yourself and run it with the -reinstall option.
Here is the Readme.txt file contents:
DESCRIPTION:
This script has a simple purpose of alerting us when a ROM has finished
compiling. Hopefully to save us the trouble of checking back constantly
to see if it finished, or even worse, to come back to our computer after
4 hours of compiling only to find out it failed 10 min into the compile.
This script will shoot out an email when the compile finishes, including
the time it took to compile and the last 6 lines of the output log. It
uses Gmail's smtp servers, so there is no need to run a email server for
use. This does store your email password in plain text for the config file
located at /etc/msmtprc. Only root can view this, but if you are
worried, create a dummy Gmail account for this scripts use. I'll work
on a better solution later.
USE:
untar in a directory, cd to the directory and run the install program.
chmod 755 acompile-install.sh && ./acompile-install.sh
then goto your working repo directory, run
. build/envsetup.sh
lunch
acompile
and wait for your email ​DOWNLOADS:
It's so nice to have my phone beep at me and tell me my compile is finished. I mostly wrote this for myself and it works perfectly for me, so I thought someone else might find it useful. I hope you enjoy it.
-Mike
DOWNLOADS:
acompile
Hey thanks for this Mike. I have yet to run a build with this but should tonight I'll report back what I find.
Sent from my EVO
I will run this now. I hate those pesky errors.
Sent from my SCH-I500 using xda app-developers app

[GUIDE][HOWTO] Setup 2way-sync over WiFi using Unison

There are a lot of howtos about pulling/pushing content over wifi around. Taking adb or AirDroid may be reliable for common use, but i was looking for a real two-way-sync without utilizing a cloud, also i wanted not too much 3rd Party-Software involved, neither on my box nor at my phone.
Although Unison is platform-independant and can be run from Windows, i'm focussing on the Linux part (coz i've got no Windows box to test). I won't go deeper into things like howto install the required applications on your box. You won't have to compile anything, precompiled binaries should be available for your distro. Guess pacman, yum and apt-get will do their job, but if in doubt, Google will lead the way.
Requirements
A rooted device
SSHDroid installed on your Android
OpenSSH, SSHFS and Unison properly installed on your Box
SSH
After ensured the requirements above, you should be able to ssh to your android device. It's ip is shown by SSHDroid.
Code:
ssh [email protected]<yourdeviceip>
First connect will take some time, coz ssh will handshake your device and save the fingerprint. After the connect succeeded, you will be easily able to connect your device anytime over wifi.
SSHFS
SSHFS allows us to mount the whole android device to a mountpoint on your box. Compare it like a external harddisk you plug into your box usb.
First we'll create a directory in our home and then mount the device into it.
Code:
mkdir wifidroid && sshfs [email protected]<your device ip>:/sdcard/ ~/wifidroid/
SSHFS will ask for your root password anytime you try to connect. If not configured different within SSHDroid, it will be admin. You're ought to change it for safety reasons. After above steps, your device is mounted into wifidroid. You can easily browse the contents using your preferred linux filemanager (like dolphin or nautilus). To unmount device, use fusermount -u ~/wifidroid/ later.
UNISON
Unison will handle the syncing between your box and your device. It comes with an cli and even with a gui. Whatever you will use is up to your personal preference.
First of all we're going to create the unison profile directory and a basic example profile for syncing pictures.
Code:
mkdir ~/.unison && touch pictures.prf
Open pictures.prf with your preferred editor (nano, vi, kate, gedit, orwutevah) and write down some config stuff.
Code:
root=/home/<username>/Pictures
root=/home/<username>/wifidroid/Pictures
path=Friends
path=Landscape
path=Misc Stuff
perms=0
ignore=Name .*~
ignore=Name *~
ignore=Name .*
The first root=/home/<username>/Pictures points to your local pictures directory, whereas the second one, root=/home/<username>/wifidroid/Pictures points to the pictures-folder at your mounted android device. Unison syncs recursevly, so it would simply sync anything beneath the directory Pictures. If you want to sync only some Subfolders, use path=Friends i. e. to include Pictures/Friends. You may edit this to your own convince. We don't want unison to set permissions on synced files, so we set perms=0. Rest should be self explanatory.
Okay, now just fire up unison with unison pictures for cli-version, or unison-gtk pictures for the gui-version and syncing should begin.
Keep in mind that, depending on your wifi speed, it will take a huge amount of time to sync a whole mp3/picture library for the first time. After first sync things should be butter smooth
Above example is just a basic profile. You can easily use unison to backup your whole device, or, as i do, make regular backups of your Camera-Roll, WhatsApp and Threema Backups. If you wanna go deeper into this, you should take a look at the Unison Reference Guide.
Genericxx said:
There are a lot of howtos about pulling/pushing content over wifi around. Taking adb or AirDroid may be reliable for common use, but i was looking for a real two-way-sync without utilizing a cloud, also i wanted not too much 3rd Party-Software involved, neither on my box nor at my phone.
Although Unison is platform-independant and can be run from Windows, i'm focussing on the Linux part (coz i've got no Windows box to test). I won't go deeper into things like howto install the required applications on your box. You won't have to compile anything, precompiled binaries should be available for your distro. Guess pacman, yum and apt-get will do their job, but if in doubt, Google will lead the way.
Requirements
A rooted device
SSHDroid installed on your Android
OpenSSH, SSHFS and Unison properly installed on your Box
SSH
After ensured the requirements above, you should be able to ssh to your android device. It's ip is shown by SSHDroid.
Code:
ssh [email protected]<yourdeviceip>
First connect will take some time, coz ssh will handshake your device and save the fingerprint. After the connect succeeded, you will be easily able to connect your device anytime over wifi.
SSHFS
SSHFS allows us to mount the whole android device to a mountpoint on your box. Compare it like a external harddisk you plug into your box usb.
First we'll create a directory in our home and then mount the device into it.
Code:
mkdir wifidroid && sshfs [email protected]<your device ip>:/sdcard/ ~/wifidroid/
SSHFS will ask for your root password anytime you try to connect. If not configured different within SSHDroid, it will be admin. You're ought to change it for safety reasons. After above steps, your device is mounted into wifidroid. You can easily browse the contents using your preferred linux filemanager (like dolphin or nautilus). To unmount device, use fusermount -u ~/wifidroid/ later.
UNISON
Unison will handle the syncing between your box and your device. It comes with an cli and even with a gui. Whatever you will use is up to your personal preference.
First of all we're going to create the unison profile directory and a basic example profile for syncing pictures.
Code:
mkdir ~/.unison && touch pictures.prf
Open pictures.prf with your preferred editor (nano, vi, kate, gedit, orwutevah) and write down some config stuff.
Code:
root=/home/<username>/Pictures
root=/home/<username>/wifidroid/Pictures
path=Friends
path=Landscape
path=Misc Stuff
perms=0
ignore=Name .*~
ignore=Name *~
ignore=Name .*
The first root=/home/<username>/Pictures points to your local pictures directory, whereas the second one, root=/home/<username>/wifidroid/Pictures points to the pictures-folder at your mounted android device. Unison syncs recursevly, so it would simply sync anything beneath the directory Pictures. If you want to sync only some Subfolders, use path=Friends i. e. to include Pictures/Friends. You may edit this to your own convince. We don't want unison to set permissions on synced files, so we set perms=0. Rest should be self explanatory.
Okay, now just fire up unison with unison pictures for cli-version, or unison-gtk pictures for the gui-version and syncing should begin.
Keep in mind that, depending on your wifi speed, it will take a huge amount of time to sync a whole mp3/picture library for the first time. After first sync things should be butter smooth
Above example is just a basic profile. You can easily use unison to backup your whole device, or, as i do, make regular backups of your Camera-Roll, WhatsApp and Threema Backups. If you wanna go deeper into this, you should take a look at the Unison Reference Guide.
Click to expand...
Click to collapse
Thanks will try
Nice job mate. I will try it.
Thanks @Genericxx, it looks complicated at first, but after reading a while it makes complete sense,
For anyone who wants an easier way for syncing between PC windows and Android, i'd recommend ES File Explorer and Goodsync (on windows PC)
First enable FTP Remote manager in ES through a WiFi same with ur PC windows. Then open Goodsync and setup a sync wizard and choose FTP and then the ip address from ES on the Right (destination)sync folder.
It works great on the Note 2 and it is awesome app! 5 star on market and thanks here.
No need to be root
Great guide, thanks a lot!
I have two things to add.
1. You do not need to root your Android device to use SSHDroid.
2. As the user of a non-rooted device, I ran into the problem of permissions when using unison. The solution:
Apart from having the
perms = 0
line in your .prf file, also add
dontchmod = true
So, my file looks like this:
Code:
perms=0
dontchmod = true
root=/home/<username>/Pictures
root=/home/<username>/wifidroid/Pictures
ignore=Name .*~
ignore=Name *~
ignore=Name .*
Placing "perms=0" and "dontchmod = true" at the beginning of the file may be important (I read it somewhere), but maybe it is not.
And it works nicely with my non-rooted device. Thanks again!
Check also UnisonSync:
https://play.google.com/store/apps/details?id=net.danielroggen.unisonsync
It's a Unison client for Android with GUI.
The advantage of unison client (rather than server) on the answer Android device is that you can connect to your server even if your shoe Android device is on a different subnet or behind a firewall (as long as your server is accessible of course).
Cheers,
D.

Categories

Resources