Allows to add arbitrary files and dconf keys to Sailfish OS backups. Requires Sailfish OS 3.2 or greater.
Important: do not uninstall MyBackup versions 1.0.5 and older. Due to what seems to be a bug in busybox, the uninstall script can end up doing rm -fr / on some versions of Sailfish OS. Update the app prior to uninstalling it - update is safe, it doesn't run that script.
Sailfish OS applications can declare what they need to be added to the backup by providing [X-HarbourBackup] section in their desktop file, which looks like this:
[X-HarbourBackup] BackupPathList=.local/share/foil/:Documents/FoilAuth/ BackupConfigList=/apps/harbour-foilauth/
BackupPathList is a colon-separated list of files and directories to backup. Paths are relative to the home directory. Directory names end with a slash and are copied recursively. Absolute paths are ignored.
BackupConfigList is a colon-separated list of dconf keys and groups. Similarly to directories, group names end with a slash and are saved and restored recursively. There is one important difference, though - the existing contents of dconf groups is lost during restore and is completely replaced by whatever was saved in the backup.
Source code: https://github.com/monich/harbour-mybackup
Translations are welcome in the form of GitHub pull requests.
Stay safe, backup often!
Comments
silta
Fri, 2022/04/08 - 10:43
Permalink
Last weekend I had to reflash my X10II and I tried this app.
All backups of app settings, folders and files are there after this.
I have to say a big thank you for your work. It safed me a lot of time.
Are there any way to make a donation?
slava
Fri, 2022/04/08 - 13:10
Permalink
I suggest that you donate some money to OpenRepos as a platform. Hosting, storage, etc. cost money too. And the platform works as a concentrator and amplifier of individual efforts, which is great.
silta
Wed, 2022/04/20 - 11:44
Permalink
Done, thank you.
rob_k
Sat, 2021/11/20 - 22:27
Permalink
Hi slava,
Will things change with Sandboxing, i.e. do I need to define other details for [X-HarbourBackup]?
slava
Sun, 2021/11/21 - 02:08
Permalink
No, I think everything should work as is.
prometheos
Fri, 2021/10/29 - 04:13
Permalink
I want to backup my Xperia10 Plus 2x SIM by CLI over ssh. (the command "vault" doe not exist in my 4.2.0.21 system).
I found the command /usr/bin/openrepos-mybackup, and with help of the parameter --help I tried to backup on my sdcard (encrypted, by the way).
Doing it as defaultuser brings:
$ usr/bin/openrepos-mybackup --action=export --home-dir=/home/defaultuser --dir=/home/defaultuser/android_storage/mccard/SFOS-BACKUP
where the target-dir has:
$ ls -ld /home/defaultuser/android_storage/mccard/SFOS-BACKUP
drwxr-xr-x 3 defaultu privileg 4096 Oct 28 17:18 /home/defaultuser/android_storage/mccard/SFOS-BACKUP
Error removing "/home/defaultuser/android_storage/mccard/SFOS-BACKUP/users/0/config.json" "No such file or directory"
But the target dir remains empty.
I got some more results after another group choice for the target dir:
$ sudo chown -R defaultuser:media_rw /home/defaultuser/android_storage/mccard/SFOS-BACKUP
$ time /usr/bin/openrepos-mybackup --action=export --home-dir=/home/defaultuser --dir=/home/defaultuser/android_storage/mccard/SFOS-BACKUP #
[W] unknown:0 - Error removing "/home/defaultuser/android_storage/mccard/SFOS-BACKUP/users/100000/config.json" "No such file or directory"
real 4m 36.56s
user 0m 3.89s
sys 0m 15.68s
No .tar was built, but a good portion of the home was replicated and partially filled under the <target dir>/users/.
Note the huge elapsed time for 388.8M onto a quick card: the GUI under Settings takes only few seconds and collects a sailfish-backup with 438.7M.
Could you help me further? I must miss here something.
My aim is to integrate a sailfish backup into my extablished backup rithmus and tools on my desktop.
slava
Fri, 2021/10/29 - 04:42
Permalink
openrepos-mybackup is registered as what's called a backup unit. Backup units don't build the .tar file, that's done by org.sailfishos.backup D-Bus service (provided by /usr/libexec/sailfish-backup). Backup units are only responsible for copying files to the temporary directory, or restoring files from there.
prometheos
Sat, 2021/10/30 - 02:10
Permalink
Ok @slava, then I expect to find something like an org.sailfishos.backup.xxx
But if I search for it, I find nothing like that:
$ systemctl --user list-units --all -l | grep -i sailfish | cat -n #
1 dev-disk-by\x2did-dm\x2dname\x2dsailfish\x2dhome.device loaded active plugged /dev/disk/by-id/dm-name-sailfish-home
2 dev-disk-by\x2did-dm\x2dname\x2dsailfish\x2droot.device loaded active plugged /dev/disk/by-id/dm-name-sailfish-root
3 dev-mapper-sailfish\x2dhome.device loaded active plugged /dev/mapper/sailfish-home
4 dev-mapper-sailfish\x2droot.device loaded active plugged /dev/mapper/sailfish-root
5 dev-sailfish-home.device loaded active plugged /dev/sailfish/home
6 dev-sailfish-root.device loaded active plugged /dev/sailfish/root
7 booster-silica-media.service loaded active running Application launch booster for Sailfish Media
8 sailfish-eas-accounts-accounts-check.service not-found inactive dead sailfish-eas-accounts-accounts-check.service
9 sailfish-eas-accounts-check.service loaded failed failed check for Sailfish-EAS accounts
10 sailfish-eas.service loaded inactive dead sailfish-eas daemon
11 sailfish-homescreen-services.service loaded active running Sailfish homescreen user agent service
12 sailfish-secretsd.service loaded active running Sailfish Secrets Daemon
What is wrong?
(edited by adding list-units --all parameters to show also inactive units, and piping into cat -n to index a count of the findings.)
slava
Sat, 2021/10/30 - 03:32
Permalink
Try
dbus-send --session --print-reply --type=method_call --dest=org.sailfishos.backup /sailfishbackup org.freedesktop.DBus.Introspectable.Introspect
prometheos
Sun, 2021/10/31 - 02:42
Permalink
@slava what I get is the text of a 162 lines long file. Here following in line:
$ dbus-send --session --print-reply --type=method_call --dest=org.sailfishos.backup /sailfishbackup org.freedesktop.DBus.Introspectable.Introspect
method return time=1635636537.621860 sender=:1.167 -> destination=:1.169 serial=19 reply_serial=2
string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.sailfishos.backup">
<property name="mode" type="s" access="read"/>
<property name="status" type="s" access="read"/>
<property name="statusText" type="s" access="read"/>
<property name="progress" type="d" access="read"/>
<property name="currentUnit" type="s" access="read"/>
<property name="error" type="s" access="read"/>
<property name="errorString" type="s" access="read"/>
<property name="canCancel" type="b" access="read"/>
<property name="logFilePath" type="s" access="read"/>
<property name="localBackupUnits" type="as" access="read"/>
<property name="cloudBackupUnits" type="as" access="read"/>
<signal name="listCloudBackupsFinished">
<arg name="accountId" type="i" direction="out"/>
<arg name="fileNames" type="as" direction="out"/>
<arg name="success" type="b" direction="out"/>
</signal>
<signal name="cloudBackupStatusChanged">
<arg name="accountId" type="i" direction="out"/>
<arg name="status" type="s" direction="out"/>
</signal>
<signal name="cloudBackupError">
<arg name="accountId" type="i" direction="out"/>
<arg name="error" type="s" direction="out"/>
<arg name="errorString" type="s" direction="out"/>
</signal>
<signal name="cloudRestoreStatusChanged">
<arg name="accountId" type="i" direction="out"/>
<arg name="status" type="s" direction="out"/>
</signal>
<signal name="cloudRestoreError">
<arg name="accountId" type="i" direction="out"/>
<arg name="error" type="s" direction="out"/>
<arg name="errorString" type="s" direction="out"/>
</signal>
<signal name="fileBackupStatusChanged">
<arg name="filePath" type="s" direction="out"/>
<arg name="status" type="s" direction="out"/>
</signal>
<signal name="fileBackupError">
<arg name="filePath" type="s" direction="out"/>
<arg name="error" type="s" direction="out"/>
<arg name="errorString" type="s" direction="out"/>
</signal>
<signal name="fileRestoreStatusChanged">
<arg name="filePath" type="s" direction="out"/>
<arg name="status" type="s" direction="out"/>
</signal>
<signal name="fileRestoreError">
<arg name="filePath" type="s" direction="out"/>
<arg name="error" type="s" direction="out"/>
<arg name="errorString" type="s" direction="out"/>
</signal>
<method name="backupToCloud">
<arg name="accountId" type="i" direction="in"/>
</method>
<method name="restoreFromCloud">
<arg name="accountId" type="i" direction="in"/>
<arg name="fileName" type="s" direction="in"/>
</method>
<method name="listCloudBackups">
<arg name="accountId" type="i" direction="in"/>
<arg name="refresh" type="b" direction="in"/>
</method>
<method name="backupToFile">
<arg name="filePath" type="s" direction="in"/>
</method>
<method name="restoreFromFile">
<arg name="filePath" type="s" direction="in"/>
</method>
<method name="cancel">
</method>
<method name="backupFileDeviceId">
<arg type="s" direction="out"/>
</method>
<method name="logFileForBackup">
<arg type="s" direction="out"/>
<arg name="fileName" type="s" direction="in"/>
<arg name="accountId" type="i" direction="in"/>
</method>
<method name="createBackupForSyncProfile">
<arg type="s" direction="out"/>
<arg name="profileId" type="s" direction="in"/>
</method>
<method name="setCloudBackups">
<arg name="profileId" type="s" direction="in"/>
<arg name="backups" type="as" direction="in"/>
</method>
<method name="mode">
<arg type="s" direction="out"/>
</method>
<method name="status">
<arg type="s" direction="out"/>
</method>
<method name="statusText">
<arg type="s" direction="out"/>
</method>
<method name="progress">
<arg type="d" direction="out"/>
</method>
<method name="currentUnit">
<arg type="s" direction="out"/>
</method>
<method name="error">
<arg type="s" direction="out"/>
</method>
<method name="errorString">
<arg type="s" direction="out"/>
</method>
<method name="canCancel">
<arg type="b" direction="out"/>
</method>
<method name="logFilePath">
<arg type="s" direction="out"/>
</method>
<method name="localBackupUnits">
<arg type="as" direction="out"/>
</method>
<method name="cloudBackupUnits">
<arg type="as" direction="out"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface_name" type="s" direction="in"/>
<arg name="property_name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface_name" type="s" direction="in"/>
<arg name="values" type="a{sv}" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
</method>
<signal name="PropertiesChanged">
<arg name="interface_name" type="s" direction="out"/>
<arg name="changed_properties" type="a{sv}" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
<arg name="invalidated_properties" type="as" direction="out"/>
</signal>
</interface>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="xml_data" type="s" direction="out"/>
</method>
</interface>
<interface name="org.freedesktop.DBus.Peer">
<method name="Ping"/>
<method name="GetMachineId">
<arg name="machine_uuid" type="s" direction="out"/>
</method>
</interface>
</node>
"
No .tar is built in the target dir.
slava
Sun, 2021/10/31 - 03:21
Permalink
Of course it won't build you the .tar file, it just gives you the description of the D-Bus interface provided by
org.sailfishos.backup service
. That's the service used by the Backup settings page which is of course it's undocumented, unstable and may change at any time. Try callingbackupToFile
on that D-Bus interface from a privileged shell, like this:[nemo@Sailfish ~]$ devel-su -p
Password:
Enjoy your privileges.
[nemo@Sailfish ~]$ dbus-send --session --print-reply --type=method_call --dest=org.sailfishos.backup /sailfishbackup org.sailfishos.backup.backupToFile string:$HOME/backup.tar
method return time=1635639229.394690 sender=:1.411 -> destination=:1.432 serial=169 reply_serial=2
[nemo@Sailfish ~]$ ls -l backup.tar
-rw-r--r-- 1 nemo privileg 2411065856 Oct 31 03:15 backup.tar
[nemo@Sailfish ~]$
You would of course have to wait long enough for the tarball to appear.
rob_k
Sun, 2021/09/26 - 12:29
Permalink
Hi slava, when I made a clean install on my 10ii with Verla 4.2, the backup of my app GMFS did not do what I wanted: backup the database.
In the .desktop file I added:
I hoped to save the database in .local/share/harbour-multi-coords/harbour-multi-coords/QML/OfflineStorage\Databases
This should have worked, right?
slava
Sun, 2021/09/26 - 13:33
Permalink
Looks about right, if you create a backup and then do
tar -tvf sailfish_backup_2021<whatever>.tar | grep harbour-multi-coords
you should see your files under./MyBackup/data/users/100000/files/.local/share/harbour-multi-coords/
rob_k
Sat, 2021/11/20 - 22:33
Permalink
Finally I looked, and indeed. The files are there. Thanks!
miroj56
Thu, 2021/08/05 - 13:12
Permalink
Great app. Why not push to jolla store? Many users would be grateful.
slava
Thu, 2021/08/05 - 15:59
Permalink
It's doing all kinds of stuff disallowed in Jolla Store. Most importantly, it installs a backup unit.
rob_k
Sun, 2021/03/14 - 13:41
Permalink
Great! I included the X-HarbourBackup in my apps, and it seems to work straightaway. Thanks!
slava
Sun, 2021/03/14 - 14:28
Permalink
Cheers!
anasyntes
Fri, 2021/01/29 - 13:13
Permalink
Many thanks. Another high-quality app from you, much appreciated!
Firefox84
Sat, 2021/01/16 - 23:38
Permalink
Do you know "My data transfer" it was a quite similar app that unfortunately was discontinued. The source can be found here: https://forum.sailfishos.org/t/my-data-transfer-missing-from-openrepos/2887
magare
Mon, 2021/01/11 - 11:26
Permalink
Great and big Thanks!
Notice one thing: I selected the entire /home/nemo folder for backup, it took a long time 30+ minutes and I stopped the process because I noticed that user data storage was running out of space. My entire /home folder uncompressed is 3.7 GB, compressed is 1.2 GB, but the backup had already consumed 8 GB when I stopped it. I suspect that the reason is some temporary file that happens in the /home/nemo folder itself or something with android_storage, don't know.
slava
Mon, 2021/01/11 - 13:35
Permalink
I think that's because the temporary files created during the backup process (those are currently under under
~/.local/share/system/privileged/Backups-tmp
) were being added to the backup.If that's not enough, some things (e.g.
~/Pictures
) are going to be included into such backup more than once.I need to check if source files are already under the destination directory and skip those.
I'll also consider hard-linking the files during the backup process if both source and destination are on the same filesystem - that would speed up the process and save the space.
Malakay
Mon, 2021/01/11 - 00:29
Permalink
Hi, did I understood correctly, that purpose of this app is to mark certain apps to be obtained in backup in standard backup proccess? Can someone confirm or explain? :)
slava
Mon, 2021/01/11 - 02:55
Permalink
Well, I tried to explain it in the description. It allows you to add arbitrary data and dconf entries to the backup (and then restore those from the backup). Check the backup talball with
tar -tvf
, the configured items should be there underMyBackup/
The application integration thing is just a convenience. If you know which files and dconf keys are being used by the application, you can add them manually. But I doubt that you know much about applications which you haven't written yourself))
Malakay
Tue, 2021/01/12 - 00:36
Permalink
I dont know what Dconf entries are :D So, for example - when I want to backup Acid Pass app, I backup with this and when its needed to be restored, I can restore it from backup. Does backed-up app need to be installed and then restored, or whole app will be restored without reinstallation?
slava
Tue, 2021/01/12 - 01:29
Permalink
That really depends on the app. DConf and filesystem are two places where apps can persistently store their state. What would actually happen when you restore app's data and configuration from the backup, depends on the app. In any case you better exit the app prior to restoring its data/configuration (to avoid partially or completely overwriting the data you've just restored) unless the app handles its persistent data and configuration being changed behind its back (like my Counter app does). So, it's really case-by-case. Sometimes it will work, sometimes it won't. The
[X-HarbourBackup]
entry in the .desktop file could serve as an indication that it at least should work.And this tool isn't even supposed to backup the contents of app's rpm. Those files can be easily restored by reinstalling the app.
nephros
Sun, 2021/01/10 - 20:45
Permalink
Wow, this is very cool. Brilliant idea with the .desktop file parameters!
eson
Sun, 2021/01/10 - 10:59
Permalink
Thanks a lot!