Higher Level TODOs?

Mary-Anne Wolf mgwmgw at comcast.net
Wed Mar 30 04:00:41 UTC 2011


Brian responded on list and Jim responded privately
about the backup idea.

Jim's opinion was that the ability to restore one's
application state to a replacement phone was the
highest priority.

As best as I could tell,
Brian did not express any opinion about the relative
priority, except to say that the ability to back up
the whole phone operating system already exists.
He also discussed how to put Replica on a trac phone
which I am not going to attempt right away.

So, assuming that no-one else chooses to express
an option, I would like to take Jim's advice.

I think perl scripts may be the easiest way to
implement this.

Here is the pseudocode of what I have in mind.

Write our use a filter which takes input and
encrypts it and sends the result to standard output.

There will also need to be a corresponding unencrypt filter.

I hope this already exists.

A backup script which backs up one application.
For each application,
pushd to the application's home directory
tar gzipped current directory to standard output
run that standard output through the encryption filter
and put the output of the encrypting into a subdirectory
of /tmp, such as /tmp/bak<date> where <date> corresponds
to the current date and time as YYMMDDHHmmss.
(I may include milliseconds too.)
The file in /tmp is then sent using sftp to the
server.

This backup script takes the path of the directory
to back up and the path of the output file
relative to /tmp, and /tmp (or another temporary
directory)
and the sftp command-line (with a place to put the
file to send) as command line parameters.

A main script which iterates down the applications
which are installed.
For each application, the backup script is called
in the background.
The script waits until all the background backups are
finished before exiting.
The main script also creates an XML file which records
all the applications which are backed up, and the name
of the file they are backed up as, and the date of the
backup.  If I can discover the versions of the applications
I would like to record that also.
This XML file is encrypted using the same filter
as above.  When all the background processes have begun,
the encrypted XML file is sftped to the server.

The destination on the server is also a subdirectory
of $HOME named bak<date>.

When the backup is completed, the main script
checks what backups exist on the server using
the ls command in sftp, and then will
delete all but the latest 3 backups on the server
using the rm command in sftp.
It will not verify whether the backups are good,
which is part of why we keep more than one.

There will be another perl script to restore a
single application, which will take as command-line
parameters the sftp command-line to retrieve
the file, the name of the file to retrieve,
and the directory to restore it in as parameters.
It retrieves the file, unencrypts it using the 
filter, 
pushd to the desired directory
clear the directory
untar and unzip the retrieved file

This allows an application to be installed
using a different user id on the new phone.

Then there will need to be a GUI front-end,
maybe written in Java, which detects all the
applications installed and allows the user
to retrieve some or all of them (by default all)
from whichever backup the user chooses 
(by default the newest which is also the last
alphabetically).

This java program will invoke the sftp using a URL.

If I know application versions then the user will
only be able to restore an application if the backup
was done with the same version.

Can I assume that perl and Java will be available?
Would I do better to use PHP?
Is there a better way to do this?

Mary-Anne


More information about the Replicant mailing list