|
|
10/31/2009, 03:07 AM
|
#1 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Location: The HARD Streets of Alpharetta, GA
Posts: 829
Likes Received: 2
Thanks: 44
Thanked 176 Times in 92 Posts
|
I've created a webos app. The UI is just the way I want it. The only thing left is to run a shell script, that I have also created and confirmed works. And to do so from a button in the webos app.
Is there a way in javascript or html to launch the shell script? The open method of the appMgr only seems to work with registered apps and mime types which won't work for shell scripts. Am I going about this all the wrong way? I need ideas people!!! hehehe! Update: The culmination of work on my first app is located in the attachment below.... Last edited by DrewPre; 04/30/2010 at 05:41 AM. |
10/31/2009, 03:33 AM
|
#3 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Location: The HARD Streets of Alpharetta, GA
Posts: 829
Likes Received: 2
Thanks: 44
Thanked 176 Times in 92 Posts
|
Yea, I thought so too, but I guess I needed someone to translate/interpret the assistants files for me. There isn't exactly any tutorials for them.
Reading those files were like reading greek. |
10/31/2009, 05:06 AM
|
#4 (permalink) |
|
Developer
![]() ![]() Join Date: Apr 2003
Location: Adelaide, Australia - follow @webosinternals on Twitter visit www.webos-internals.org and www.facebook.com/webosinternals
Posts: 10,220
Likes Received: 546
Thanks: 90
Thanked 8,534 Times in 2,806 Posts
|
A mechanism that allowed a webOS app to run any shell command it wanted to would be a HUGE security hole.
You need to write a service which does exactly and only what you need it to do, and carefully review it so that it doesn't open up any security vulnerabilities. See git.webos-internals.org for example services. -- Rod
__________________
WebOS Internals and Preware Founder and Developer You may wish to donate by Paypal to donations @ webos-internals.org if you find our work useful. All donations go back into development. www.webos-internals.org twitter.com/webosinternals facebook.com/webosinternals |
10/31/2009, 06:07 AM
|
#5 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Location: The HARD Streets of Alpharetta, GA
Posts: 829
Likes Received: 2
Thanks: 44
Thanked 176 Times in 92 Posts
|
yea, I took a look at some of the src code for a few of thoses services....it's way above my head. How would one get started writing a service? What are the pre-reqs for learning that kinda stuff?
|
10/31/2009, 06:18 AM
|
#6 (permalink) | |
|
Developer
![]() ![]() Join Date: Apr 2003
Location: Adelaide, Australia - follow @webosinternals on Twitter visit www.webos-internals.org and www.facebook.com/webosinternals
Posts: 10,220
Likes Received: 546
Thanks: 90
Thanked 8,534 Times in 2,806 Posts
|
Quote:
In the future, knowing C will be enough. Knowing Makefiles will be an advantage for either. -- Rod
__________________
WebOS Internals and Preware Founder and Developer You may wish to donate by Paypal to donations @ webos-internals.org if you find our work useful. All donations go back into development. www.webos-internals.org twitter.com/webosinternals facebook.com/webosinternals |
|
10/31/2009, 06:26 PM
|
#7 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Location: The HARD Streets of Alpharetta, GA
Posts: 829
Likes Received: 2
Thanks: 44
Thanked 176 Times in 92 Posts
|
I don't know C or Make files...
I don't know JAVA either... but I took the time to search and teach myself just enough to do this..... ![]() I also went in a different direction and created this app for the Palm Pre. ![]() ![]() I created these two apps to have two options to perform the same tasks....So I am not completely clueless when it comes to coding. I am not asking anyone to spoon feed me but point me in the right direction, please. |
10/31/2009, 06:31 PM
|
#8 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Location: The HARD Streets of Alpharetta, GA
Posts: 829
Likes Received: 2
Thanks: 44
Thanked 176 Times in 92 Posts
|
Okay maybe I AM asking for someone to spoon feed me. It would be nice if you could put a bib on me and burp me when you're done!!
I have the time and motivation right now and I want to learn this stuff. |
10/31/2009, 06:40 PM
|
#9 (permalink) | |
|
Developer
![]() ![]() Join Date: Apr 2003
Location: Adelaide, Australia - follow @webosinternals on Twitter visit www.webos-internals.org and www.facebook.com/webosinternals
Posts: 10,220
Likes Received: 546
Thanks: 90
Thanked 8,534 Times in 2,806 Posts
|
Quote:
What exactly do you need the service to do? -- Rod
__________________
WebOS Internals and Preware Founder and Developer You may wish to donate by Paypal to donations @ webos-internals.org if you find our work useful. All donations go back into development. www.webos-internals.org twitter.com/webosinternals facebook.com/webosinternals |
|
10/31/2009, 07:04 PM
|
#10 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Location: The HARD Streets of Alpharetta, GA
Posts: 829
Likes Received: 2
Thanks: 44
Thanked 176 Times in 92 Posts
|
well at the moment, just want the service to call a shell script that I have already created that when passed a couple of parameters [e.g. which directories to backup] will identify the directorys existence adn then tarball them and move them to media/internal.
further down the line, I would like to add an option to export contacts to CSV file, and this to I already have a shell script for. So again, at the moment, I just need the service to launch a shell script and the ability to pass it a few parameters. Gonna check out your links now..... |
11/01/2009, 01:00 AM
|
#13 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Location: The HARD Streets of Alpharetta, GA
Posts: 829
Likes Received: 2
Thanks: 44
Thanked 176 Times in 92 Posts
|
Okay I think I have formulated something that resembles a java service based on the executeCMD found in the optLoop service link you provided.
However, I have no way of testing it. I just spent about an hour trying to figure out how to load jdk on the emulator only to find that the emulator doesn't have enuff hdd space and even after add/mounting a 2gb vdd to the emulator and copying the jdk installer to it and running it I get errors. So I am at a lose as to how to compile this in the emulator and test it. I could use some help in setting up my emulator for a development environment. |
11/01/2009, 01:15 AM
|
#14 (permalink) | |
|
Developer
![]() ![]() Join Date: Apr 2003
Location: Adelaide, Australia - follow @webosinternals on Twitter visit www.webos-internals.org and www.facebook.com/webosinternals
Posts: 10,220
Likes Received: 546
Thanks: 90
Thanked 8,534 Times in 2,806 Posts
|
Quote:
-- Rod
__________________
WebOS Internals and Preware Founder and Developer You may wish to donate by Paypal to donations @ webos-internals.org if you find our work useful. All donations go back into development. www.webos-internals.org twitter.com/webosinternals facebook.com/webosinternals |
|
11/01/2009, 01:18 AM
|
#15 (permalink) | |
|
Developer
![]() ![]() Join Date: Apr 2003
Location: Adelaide, Australia - follow @webosinternals on Twitter visit www.webos-internals.org and www.facebook.com/webosinternals
Posts: 10,220
Likes Received: 546
Thanks: 90
Thanked 8,534 Times in 2,806 Posts
|
Quote:
That's how I test the Package Manager Service - compile and jar it on the host (a MacBookPro in my case) and scp it to the Pre. -- Rod
__________________
WebOS Internals and Preware Founder and Developer You may wish to donate by Paypal to donations @ webos-internals.org if you find our work useful. All donations go back into development. www.webos-internals.org twitter.com/webosinternals facebook.com/webosinternals |
|
11/01/2009, 01:42 AM
|
#16 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Location: The HARD Streets of Alpharetta, GA
Posts: 829
Likes Received: 2
Thanks: 44
Thanked 176 Times in 92 Posts
|
That's another thing.....
Do you scp it to your Pre or your Emulator? I can't seem to get a ping-able ip address for my emulator. I can ping my host from the emu, but I can't ping the emu from the host. iptables and PS doesn't show a firewall running. The host shows up as 192.168.56.x and the emu as 10.0.2.x and no matter what I do I can't ping the emu from the host. I even tried adding a persistent route to the host. Didn't work! I can novaterm into the emu but I would like to use SSH Secure Shell to connect instead. I made sure the ssh client was trying to connect to port 2222 but.... nothing. |
11/01/2009, 02:02 AM
|
#17 (permalink) | |
|
Developer
![]() ![]() Join Date: Apr 2003
Location: Adelaide, Australia - follow @webosinternals on Twitter visit www.webos-internals.org and www.facebook.com/webosinternals
Posts: 10,220
Likes Received: 546
Thanks: 90
Thanked 8,534 Times in 2,806 Posts
|
Quote:
I add a second network interface in VirtualBox, and set it to host-only vboxnet0 - this gives me a private 192.168.58.x subnet on which both the host and all the virtualbox VMs live (handy for scp'ing from the Ubuntu virtual machine to the Pre or Pixi virtual machines). Then I install optware on the emulator using the bootstrap script, and set it up for scp access over the 192.168.56.x interface (you have to modify /etc/network/interfaces on the emulator to enable the second network interface and allow to to get an address from the host using DHCP). -- Rod
__________________
WebOS Internals and Preware Founder and Developer You may wish to donate by Paypal to donations @ webos-internals.org if you find our work useful. All donations go back into development. www.webos-internals.org twitter.com/webosinternals facebook.com/webosinternals |
|
11/01/2009, 02:17 AM
|
#18 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Location: The HARD Streets of Alpharetta, GA
Posts: 829
Likes Received: 2
Thanks: 44
Thanked 176 Times in 92 Posts
|
I used novaterm to go through the bootstrap script but it never prompted me to setup a new/additional user like it did on my real Pre. I've run and Re-run it and I could never get it to prompt me for taht additional user.
no errors are displayed tho. And it completes saying that ssh and scp are set up....and I can see a dropbear process in PS but there is no optware-dropbear startup file in /etc.... so I have no idea if it has launched with the -g parameter to disable root logins. So that could be preventing me from logging in also. Update: Scratch all that, I am in. |
11/01/2009, 02:55 AM
|
#19 (permalink) | |
|
Developer
![]() ![]() Join Date: Apr 2003
Location: Adelaide, Australia - follow @webosinternals on Twitter visit www.webos-internals.org and www.facebook.com/webosinternals
Posts: 10,220
Likes Received: 546
Thanks: 90
Thanked 8,534 Times in 2,806 Posts
|
Quote:
-- Rod
__________________
WebOS Internals and Preware Founder and Developer You may wish to donate by Paypal to donations @ webos-internals.org if you find our work useful. All donations go back into development. www.webos-internals.org twitter.com/webosinternals facebook.com/webosinternals |
|
11/04/2009, 01:37 AM
|
#20 (permalink) |
|
Member
![]() ![]() Join Date: Aug 2009
Location: The HARD Streets of Alpharetta, GA
Posts: 829
Likes Received: 2
Thanks: 44
Thanked 176 Times in 92 Posts
|
I added the code below to the corresponding sections of the ipkgservice.java file of the ipkgservice service that you instructed me to look at.
I then installed it in my emulator and then I modified my Palm Backup Util's main-assistant.js file to look like the doRescan function of the Luna Manager app. My assumption is that the startButton function in my Palm Pre Backup app should act just like the doRescan function of the Luna Manager app. In that they put in a call to ipkgservice to run 'backup' and 'rescan' respectively. Apparently this is a wrong assumption. It does not execute the script that I have told it to.... Code:
private JSONObject startButton(ServiceMessage msg)
throws JSONException, LSException {
JSONObject reply = new JSONObject();
ReturnResult ret = executeCMD("/opt/bin/ppbku");
reply.put("returnValue",(ret.returnValue == 0));
reply.put("stdOut", ret.stdOut.toString());
reply.put("stdErr", ret.stdErr.toString());
if (ret.returnValue!=0) {
reply.put("errorCode", ErrorMessage.ERROR_CODE_METHOD_EXCEPTION);
reply.put("errorText", "Failure during 'Backup' operation");
}
return reply;
}
Code:
@LunaServiceThread.PublicMethod
public void backup(ServiceMessage msg)
throws JSONException, LSException {
JSONObject reply = startButton(msg);
msg.respond(reply.toString());
}
Code:
MainAssistant.prototype.continueBtn = function(event)
{
try
{
this.controller.get("announcement").update("Processing...");
this.controller.stageController.pushScene('process', this.checkboxBRModel, this.checkboxPDModel);
var r = new Mojo.Service.Request
(
'palm://org.webosinternals.ipkgservice',
{
method: 'backup',
onSuccess: this.callbackFunction.bindAsEventListener(this, 'Backup'),
onFailure: this.callbackFunction.bindAsEventListener(this, 'Backup')
}
);
}
catch (e)
{
Mojo.Log.logException(e, 'main#continueBtn');
this.alertMessage('main#continueBtn Error', e);
}
}
|
![]() |
|
| Tags |
| backup app |
| Thread Tools | |
| Display Modes | |
|
|



