Steps to clone/sync a phone(sailfishOS) with another or with storage

Hello,

I am want to clone / sync two devices (xperia 10iii) daily. At the moment I want one way sync. After a lot of search I couldn’t find anything existing, I already made a home made backup shell script which helped me a lot with the most important data I wanted(contacts, commhistory, bookmarks etc), but I want to make it even better by automating:

  • install on the second device the same repositories (openrepos, chum etc) and apps the first one has
  • remove also the ones that I removed on main device
  • sync the way I organized the apps in apps grid (order / groups)
  • sync ambient (themes?) image / settings
  • sync alarms/timers
  • sync accounts (mail/ calendars)
  • sync top menu buttons and way they are organized
  • would also be nice to sync android apps and their data

all above by ssh, shell scripting and rsync when it is needed.

On the main device:
for repositories what I have found until now from command line:

ssu lr | awk '{ print $2,$4}' 

I suppose I can get the output to a file and using a for loop (shell script) I could install / activate them on the secondary device. Also I had the idea to just rsync the directory /etc/zypp/repos.d, if it is going to work it much easier/ simpler.

for installed packages:

 rpm -qa --queryformat "%{NAME}\n"

I haven’t found a way to mass install all packages after I install the repositories. I checked pkcon and zypper without luck.

Does anyone have any ideas how can I do that or any of the above bullets?

Thank you in advance

3 Likes

Those two are dconf keys. You can dconf dump /path/to/location > file and cat file | dconf load /path/to/location

Which locations exactly depends, Theme information for example is kept at /desktop/jolla/theme/, other desktop specific stuff like topmenu config generally is also under /desktop but can be elsewhere in the dconf hierarchy.

Do a dconf dump / | less and explore for things you want to transport.

2 Likes

AFAIK that’s kept at ~/.timed:

1 Like

That’s kept in some directory in ~/.local or ~/.config, I don’t remember which one exactly.
Be very careful with this though, I’d expect problems with Launcher if the apps installed aren’t the same on both devices.

Speaking of which, Storeman has the option to backup the installed files list, and restore it. You could use that to at least have the ones from OpenRepos the same.

3 Likes

As long as it is only one-way it boils down to backup/restore. What you will run into is the fun (actually not at all) fact that a sailfish os backup hardly contains everything people care about.

It might make sense to look into existing backup/restore and build on top of it. And on the way report gaps and suggest/implement mitigations for them.

Improving backup/restore for everyone would be a really cool contribution, and doing that upstream would also help you get that topic off your plate at some point.

But i would say the whole topic is still open in sailfish and a good solution would likely go down to partitioning level. If that was btrfs your sync would be send/receive.

thank you for the input @nephros ! I will include these paths and dconf values in the sync-backup script. I am keep searching solution for the installed packages part.

@hennsch my developing skills are not enough to check the existing backup / restore application and improve it.

When I have something decent as working prototype I will post it here!

A complete list of installed packages would be the output of:

pkcon get-packages --filter installed  | awk '/^Installed/ {print $2}'

or

rpm -qa

but I’m not sure how to reliably and safely use the list for package re-instalation/sync.

I guess you can always do a

 diff -u <( ssh phoneone "rpm -qa|sort -u") <( ssh phonetwo "rpm -qa | sort -u")

and then decide what to install.

guys … I made the repositories and packages part and the Apps grid with Folders etc! It is not automated yet (or a ready script), I did the following (try it at your own risk):

  1. Main Device: export list of repositories: ssu lr | awk '{ print $2,$4}' > repos - awk to have a list with repository name and then the link, as ssu ar wants
  2. Main Device: export list of packages: rpm -qa --queryformat "%{NAME} " > packages in main device (space between } and " is important!)
  3. Copy the above generated file packages to the Second Device
  4. Secondary Device: add repositories using “ssu ar NAME and URL” - I added manually ssu ar in the list from step 1.
  5. Secondary Device: run pkcon refresh (it will take a while)
  6. Secondary Device: pkcon install `cat packages` -y
  7. Secondary Device: after pkcon finnish you should see all installed apps in apps grid
  8. Copy the contents of directory /home/defaultuser/.config/lipstick from the Main Device to the same directory on Secondary Device
  9. Secondary Device: Go to Settings → Utilities → Home screen Restart

That’s it! Now you should be able to see the Apps organized as the Main device!

What is missing from the apps:
Any app that wasn’t installed using repositories but rpm (it could be easy to install them if they exist in a standard directory ex. Downloads/rpm)
A home made “App” that runs a shell script
Bookmarks from browser
Android apps ( Even if I had android support on secondary device I don’t know how this could be done and sync the settings of the apps )
Any Apps settings since I didn’t sync yet anything from .local and .config .

Hmm, cant you use simple backup plus mybackup?
With mybackup you can backup data of those apps supporting that plus any folder.

Just an idea

@pawel.spoon I tried mybackup, nice app! Unfortunately it doesn’t offer all the things I need and also I am looking for an automated solution, without having to run an app by hand. I tried simple backup, I transferred the file to the second device but it seems it can read a backup only from micro-sd …