Active Topics

 


Reply
Thread Tools
Posts: 44 | Thanked: 15 times | Joined on Jan 2009 @ China
#1
Hi,
I've been trying to write scripts to run the Garnet VM. I've been following the directions from Mara's post on creating executable scripts:

http://www.internettablettalk.com/wi..._using_OS_2008

My problem: after copying the *.sh files over to /home/user/MyDocs, the chmod +x doesn't seem to do anything. I assumed that *.desktop files would be created automatically, but I seem to be mistaken. After I execute "chmod" for each file, there are no visible changes in the /home/user/MyDocs folder.

I typed up the scripts using TextWrangler (a donateware text editor on the Mac that is friendly to programmers). I've started off by creating these scripts to backup, restore and launch the Garnet VM:

To Launch (saved as GLaunch.sh):
Code:
/usr/bin/gvm/gvm -S --rotated=no --fullscreen=no --deviceid=D050 --serialnum XXXXXXXXXXXX-X --hotsyncid=XXX XXX
Note: D050 is the device ID for a Palm TX, the serialnum argument did not list an "=" after the argument in TA-T3's post, so I didn't add one. The serial number is supposed to be 12 digits; I took mine off of my Palm TX (found via FileEZ) which as 12 digits followed by a dash and one letter.

To Backup the gvm.store (saved as GBackup.sh):
Code:
tar cvf /media/mmc2/gvm-backup.tar .gvm
To Restore gvm.store from the backup (saved as GRestore.sh):
Code:
tar xvf /media/mmc2/gvm-backup.tar
I copied these three files to the /home/user/MyDocs folder using emelfm2. Then:

1. I opened XTerm and did "sudo gainroot"
2. I did "cd /home/user/MyDocs"
3. I did "ls" to make sure the script files were present
4. I did "chmod +x *.sh" for each of the script files (where "*" is the name of each of the files
5. I then did "ls" again to see if there were any changes in the directories, but there were none. I even checked to see if there were hidden files (checking the green "H" in emelfm2).

I started to manually create *.desktop files for these scripts, but I realized that I didn't know the syntax for such files. I've taken the following example from one of burmashave's posts. For someone who is more experienced, will this do?

Code:
[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Script
Name=GLaunch
Exec=/home/user/MyDocs/GLaunch.sh
Comment=to launch GVM using set parameters
So, can someone help me figure out:
1. Why the chmod command doesn't seem to be working for me
2. Can I just create *.desktop files manually as above and transfer these to /usr/share/applications/hildon and have the executable show up in "Extras"?
3. If the *.desktop file looks okay, will it then execute my chmod'd *.sh files as they are now?

Thanks!

By the way, I'm running Diablo on an n810.

Update:
Well, I went ahead and double-checked the form for a *.desktop file on the wiki and wrote one in TextWrangler and copied it over to /usr/shared/applications/hildon. Sure enough, it showed up in Extras, but, when I clicked on it, nothing happened. Here is the code I used for the GLaunch.desktop file:

[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Name=GLaunch
Exec=/home/user/MyDocs/GLaunch.sh
X-Osso-Type=application/x-executable
Comment=to launch GVM using set parameters

Last edited by Palmleavr; 2009-03-21 at 17:53. Reason: update
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#2
Code:
Type=Script
should be Type=Application

And add "#!/bin/sh" (w/out quotes) to the top of your scripts.
 
Posts: 44 | Thanked: 15 times | Joined on Jan 2009 @ China
#3
Thanks qwerty12 (Faheem),
However, I tried your suggestion, and chmod still doesn't work for me.

I opened my *.sh files using Leafpad on the n810 and added the line you suggested: #!/bin/sh

I then did a "Save As..." for each file using Leafpad then copied the files into the /home/user/MyDocs folder as above. After that, when I did "chmod +x *.sh" for each of the files, nothing happened. I tried installing my GLaunch.desktop file (using Type=Application) into /usr/share/applications/hildon--but, when I tapped the icon in Extras, there was no response, not even an error message.

I appreciate any help!
 
Posts: 44 | Thanked: 15 times | Joined on Jan 2009 @ China
#4
Update: well here's something bizarre.
I decided that the problem, perhaps, was in the GLaunch.sh script, so I typed up a GBackup.desktop file and copied that into the ~/hildon folder. When I executed the GBackup from Extras, I got a gvm-backup.tar file that was only 10 kb in size.

I then deleted that file and executed the command directly in XTerm:
tar cvf /media/mmc2/gvm-backup.tar .gvm

After that, I got a gvm-backup.tar file that was 576 mb in size (the command also backed up my eight alternate gvm.store files).

Now this script and *.desktop file thing has got me really confused!
 
slvr32's Avatar
Posts: 168 | Thanked: 104 times | Joined on Feb 2008 @ California, USA
#5
You probably want to make the script run in a subshell, and take advantage of your environment to make sure you're sitting in the appropriate directory...

for example...

Code:
#!/bin/sh

dest=/media/mmc2/gvm-backup.tar

(
    cd $HOME
    tar cvf $dest .gvm
)

and...

Code:
#!/bin/sh

src=/media/mmc2/gvm-backup.tar

(
    cd $HOME
    if [ -f $src ]; then
        tar xvf $src
    else
        echo "$src doesn't exist"
    fi
)
Also, 'ls -l' should show you the permissions on the scripts after you chmod +x them, and you'll probably see something like

-rwxr-xr-x (755 permissions, for example)

where the parentheses in each script cause the code in parentheses run in a subshell, cd to the home directory, run the other commands, etc... without changing the directory outside of the context of that subshell.

Last edited by slvr32; 2009-03-22 at 03:59.
 

The Following 2 Users Say Thank You to slvr32 For This Useful Post:
Posts: 44 | Thanked: 15 times | Joined on Jan 2009 @ China
#6
slvr32, thanks!
I retyped my scripts in Leafpad on my n810 using your tips. I then tried out chmod a+x which, from what I understand from one of TA-t3's posts, should function pretty much as chmod +x. This is what happened (I've "bolded" my inputs to make this easier to read):

Code:
BusyBox v1.6.1 (2008-09-18 09:43:17 EEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ sudo gainroot
Root shell enabled


BusyBox v1.6.1 (2008-09-18 09:43:17 EEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

/home/user # cd /home/user/MyDocs
/home/user/MyDocs # ls -l
drwxr-xr-x    2 user     users        8192 Mar 17 23:21 Books
-rw-r--r--    1 user     users          77 Mar 22 17:27 GBackup.sh
-rw-r--r--    1 user     users         125 Mar 22 17:26 GLaunch.sh
-rw-r--r--    1 user     users         135 Mar 22 17:28 GRestore.sh
/home/user/MyDocs # chmod a+x GLaunch.sh
/home/user/MyDocs # chmod a+x GBackup.sh
/home/user/MyDocs # chmod a+x GRestore.sh
/home/user/MyDocs # ls -l
drwxr-xr-x    2 user     users        8192 Mar 17 23:21 Books
-rwxr-xr-x    1 user     users          77 Mar 22 17:27 GBackup.sh
-rwxr-xr-x    1 user     users         125 Mar 22 17:26 GLaunch.sh
-rwxr-xr-x    1 user     users         135 Mar 22 17:28 GRestore.sh
/home/user/MyDocs #
It looks like the chmod command had no effect on any of the script files. Any hints about what I'm doing wrong?
 
Posts: 755 | Thanked: 406 times | Joined on Feb 2008 @ UK
#7
Palm: You can see there that the chmod command did add the executable permission for all of your .sh scripts.
Code:
-rw-r--r--    1 user     users          77 Mar 22 17:27 GBackup.sh
-rw-r--r--    1 user     users         125 Mar 22 17:26 GLaunch.sh
-rw-r--r--    1 user     users         135 Mar 22 17:28 GRestore.sh
read/write

Code:
-rwxr-xr-x    1 user     users          77 Mar 22 17:27 GBackup.sh
-rwxr-xr-x    1 user     users         125 Mar 22 17:26 GLaunch.sh
-rwxr-xr-x    1 user     users         135 Mar 22 17:28 GRestore.sh
read/write/execute
 

The Following User Says Thank You to codeMonkey For This Useful Post:
Posts: 44 | Thanked: 15 times | Joined on Jan 2009 @ China
#8
Codemonkey,
Whoa, yes! Thanks for pointing that out! I missed the "x" because I was looking for some stuff in parentheses on the line.

I tried out the .desktop file I wrote to backup the gvm.store and that worked now. The script that I wrote to launch the GVM with Hotsync ID, serial number, etc. information still won't execute. I suspect it's a problem with the script, so I'm going to post over at the Palm OS forum for that issue.

Thanks for everyone who helped me finally get the script thing to work!
 
Posts: 3,841 | Thanked: 1,079 times | Joined on Nov 2006
#9
Have you tested your scripts manually, that is, from an xterm?
If they don't work, check that you have not accidentally created scripts with carriage return/line feed line endings instead of just line feed line endings. Shell scripts with cr/lf won't work.

If there are cr/lf line endings then the script can be fixed by passing it through 'tr -d "\r"', e.g. cat script.sh | tr -d "\r" > newscript.sh
__________________
N800/OS2007|N900/Maemo5
-- Metalayer-crawler delenda est.
-- Current state: Fed up with everything MeeGo.
 
Posts: 44 | Thanked: 15 times | Joined on Jan 2009 @ China
#10
TA-t3,
Thanks for your post! I've left you lots of thanks for all the script suggestions I've lifted from your work!

To answer your question, no, I didn't try to launch the scripts manually from XTerm until after I saw your post. I tried just launching a Palm app (Pleco Dict) using the following script:
Code:
#!/bin/sh
/usr/bin/gvm/gvm -O yes -z 1.5 -f yes -i D050 -a PLDE -u "Xxx Xxx:1107" -S
When I tried running this with the "-S" option, I got this error:

HTML Code:
/home/user/MyDocs # sh Pleco.sh
Garnet (tm) VM v1.0 (Prod-Release) - Build 611976 (Nov 25 2008-18:07:55)
GVM:  Unknown option -S
After I eliminated the -S option, the VM did launch. However, it launched directly to the Prefs screen in Portrait mode. None of my installed apps showed up when I hit the home button.
When I exited that GVM and launched the GVM launcher from the menu, I was able to see all my installed apps just fine, but the Hotsync ID was still set to: 0. Even when I changed the App Creator ID to Filz (Filez), I got the same result.

I originally used TextWrangler on my Mac with line endings set to Unix mode. The latest scripts were typed on LeafPad on my n810, so I assume there should be no carriage return problem.

I also tried writing the script with all "short" OR all "long" options (i.e., "-f" versus "--fullscreen"), but that didn't change the outcome. Any ideas why I can't get the GVM to launch correctly?
 
Reply

Tags
desktop, gvm, scripts


 
Forum Jump


All times are GMT. The time now is 13:53.