Ok..so people asked for a walk thru of making a script...here is my attempt at a complete walk thru. note that the script itself i create here does not work..its just a sample of what you would do. let me know if you have any questions. And each script is a little different and you may need to make some changes, but for the most part, this should help. Also, this is for Windows users (that is what I am on), but I am sure it can be modified for others
Programs you will need:
also, you will need access to the webOS command prompt . I highly recommend using the Windows Command prompt to get there, and not use the command prompt from webOS QI. I did this by installing the Palm SDK (
SDK Download - Palm Developer Center )
Finally, I suggest you take a look at this site:
git.webos-internals.org Git - applications/saverestore.git/tree - scripts/ and get familiar with some existing scripts (note that when writing scripts, you do NOT include the line #s on each script)
Once this is done, you are ready to get started.
Starting steps:
1) Put your phone in Developer Mode, connect to the Computer, and select “Just Charge”
2) Load up webOS Quick Install
3) open up 2 windows command prompts (you can do this by clicking on “Start”, “Run” then type “cmd”, then do it again)
Now, here is what you need to do
1) Use the App you want to create the script for for a little while. If it’s a game, make sure you get through a few levels. If it’s an app, make sure you load it up and make some changes in the app
2) in one command prompt, type in “novacom -t open tty://” to get to the phone’s command prompt.
3) in the other windows command prompt, change to the directory that you installed “tofrodos”
4) you need to figure out the App ID of the application that you are trying to create the script for. There are a few ways to do this, but the easiest is to open up the save/restore app, click on “install applications” and find the app and copy the App ID (e.g. Facebook = “com.palm.app.facebook”). You can also use webOS Quick Install's Device Management window
5) When you write a script, there are 4 types of saves that you may need:
Files, Cookies, Databases, Query (but you will RARELY use the Query version)
- Files = Save specific files. Usually only used for PDK Apps
- Cookies = Almost all non-PDK apps use cookies to save details
- Databases = If any app saves a lot of user-entered data (vs games that may just keep your progress of what level you reached), it probably uses a Database
6) To check to see if you need to save specific files, in the Phone’s command prompt window, you want to check the files in the apps directory. Using facebook as an example, type in:
Code:
ls -l -r -t /media/cryptofs/apps/usr/palm/applications/com.palm.app.facebook
This will give you a listing of all files, the “-l” will give you DETAILED view, “-t” sorts in chronological order, and “-r” give you the newest file on the bottom. Look to see if anything was changed with a timestamp of when you last used the app. Note that sometimes, the app may have a subdirectory that you need to check. You can tell if something is a directory if the attributes have a “d” in the beginning. (E.g. “sample” below is a directory, “file” is not)
Code:
drwxr-xr-x 2 root root 1024 Mar 19 19:58 sample
-rw-r--r-- 1 root root 1482572 Mar 19 19:58 file
if there are more directories, you may need to look in them. E.g. in the “sample” directory above, you would then need to
Code:
ls -l -r –t /media/cryptofs/apps/usr/palm/applications/com.palm.app.facebook/sample
and look to see there are any files in there you need. If there are files, mark down the DIRECTORY and ALL Files you need
7) To check to see if the app uses a Cookie or a database, the easiest way is to use webOS Quick Install, select “Tools” – “Receive File”, and get the following 2 files:
Code:
/var/palm/data/Databases.db
/var/palm/data/cookies.db
Then, open each one of these databases (with SQLite Database Browser) and do a search for the application to see if it has an entry. If it does, then you know you need to backup the database and/or the cookie
8) so, now you are ready to write your script. Lets assume its for facebook application. So, the name of the script will be “com.palm.app.facebook”
Each script will start off with the following (replace “Name of program” with the name of the program)
Code:
#!/bin/sh
APPID=`basename $0`
APPNAME="NAME OF PROGRAM"
source `dirname $0`/srf.app.info
Lets assume that you have all 3 situations for your app (2 files: “facebook.dat and pref.dat”, in the “\sample” directory), database, and cookies.
For the file section :
Code:
SRCDIR="$APPDIR/sample"
FILES=" facebook.dat pref.dat"
source `dirname $0`/srf.app.files
For the Database:
Code:
source `dirname $0`/srf.app.databases
For the cookies:
Code:
source `dirname $0`/srf.app.cookies
Then always end with:
So, the final script would look like :
Code:
#!/bin/sh
APPID=`basename $0`
APPNAME="NAME OF PROGRAM"
source `dirname $0`/srf.app.info
SRCDIR="$APPDIR/sample"
FILES=" facebook.dat pref.dat"
source `dirname $0`/srf.app.files
source `dirname $0`/srf.app.databases
source `dirname $0`/srf.app.cookies
exit 0
- Note that if the there was NOT a “sample” subdirectory, you would just write: SRCDIR="$APPDIR"
- Also, please make sure there is an extra “Hard Return” after “exit 0”
So, now you have a script. However, because of the way the Windows treats Line Endings is different than how Linux treats line endings, you need to do the following:
1) Copy the script to the directory that you have the “tofrodos” application. If windows added a “.txt” to the filename, make sure you remove that. Then, in the 2nd windows command prompt (the one where you changed to the “tofrodos” folder), you need to run the following command: “Fromdos scriptname”. So, for the example above:
Code:
Fromdos com.palm.app.facebook
2) using webOS Quickinstall, select “Tools” – “Send File” and send this file to:
Code:
/var/svc/org.webosinternals.saverestore/
3) In the Linux command prompt, make sure you are in the root directory (just in case, you can write “cd /”) and then run the following command (using the facebook example) to make the file executable
Code:
chmod ugo+x /var/svc/org.webosinternals.saverestore/com.palm.app.facebook
4) then, first test out the code by typing:
Code:
sh -x /var/svc/org.webosinternals.saverestore/com.palm.app.facebook info
with the “info” tag, I use this just to make sure that the code can recognize the script. If you get anything other than “exit 0” at the end, something is wrong!
5) if the “info” works, try running a “save”
Code:
sh -x /var/svc/org.webosinternals.saverestore/com.palm.app.facebook save
again, if you see anything other than “exit 0” at the end, then something went wrong. It’s hard to tell you what went wrong without seeing it, but something went wrong
6) go into the app and make changes. Play some more, delete some items, etc
7) back at the command prompt, run the “restore”
Code:
sh -x /var/svc/org.webosinternals.saverestore/com.palm.app.facebook restore
again, if you see anything other than “exit 0” at the end, then something went wrong.
At this point, try loading up the app and see if it reset the app back to the “save” position. If it did NOT, then it could be an issue where the cookies were cached by the device and it just wasn’t updating. Close out of the app, run the “restore” command again, and then IMMEDIATELY do a Luna Restart. When it’s back on, open the app and see if it worked
If this worked, then try loading up the save/restore app on the device and make sure that the save and restore works that way, too.
Don’t forget to replace the “com.palm.app.facebook” name in the example above with your app name you need.
FINAL STEP (thanks Rod for the reminder): Post the script here so we can add it to the app!