+ Reply
Results 1 to 10 of 10

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: $50 - Running sh script from within app or copying files

is a discussion within the

iPhone / iPod Touch SDK | Development Discussion

forums, a part of the

3rd Party Apps For iPhone | iPod Touch

section;
I'm trying to accomplish two goals... I'm not sure how to accomplish it and I have tried for over an hour I am trying to make a jailbreak app which
...
  1. #1
    What's Jailbreak?
    Join Date
    Oct 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default $50 - Running sh script from within app or copying files
    I'm trying to accomplish two goals... I'm not sure how to accomplish it and I have tried for over an hour

    I am trying to make a jailbreak app which when you press a uibutton it executes a sh script..

    App location is /Application/Test.app
    Script Location is /Application/Test.app/start.sh (copied into bundle after the fact))

    I've tried the following and it doesn't work...

    Code:
    NSString* commandToRun = @"/Applications/Test.app/start.sh";
    system([commandToRun UTF8String]);
    I've also tried to skip the script and just copy the file to /Library/Wallpapers directly... Using some of the commands below..

    PLEASE HELP!
    Code:
    	NSData *fileData = [NSData dataWithContentsOfFile:@"/Applications/Test.app/hello.jpg"];
    	NSFileManager *fm = [NSFileManager defaultManager];
    	[fm createFileAtPath:@"/Library/Wallpapers/hello.jpg" contents:fileData attributes:nil];
    Code:
    	NSFileManager *fm = [NSFileManager defaultManager];
    	[fm copyItemAtPath:@"/Applications/Test.app/hello.jpg" toPath: @"/Library/Wallpapers/" error:nil];
    If anyone can solve this for me exactly how I described $50 via paypal is yours.

  2. #2
    Developer
    Join Date
    Oct 2009
    Posts
    23
    Thanks
    0
    Thanked 13 Times in 4 Posts

    This is probably possible, (although I'm not exactly sure how) but you could just add your shell script as one of the buttons in mobile terminal (click the carrier icon and add your command to the menu) and then it would only be 2 clicks. One to open up mobile terminal, and then hold down on the text part and let go on your command button. That would still be sorta quick, and when you press the home button you don't have to worry about it killing your script.

  3. #3
    What's Jailbreak?
    Join Date
    Oct 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I'm convinced something else is going on.. I setup bash scripts.. have everything setuid'd.. owners set to root:admin .. and it still doesn't work.. i get the app to launch as root and it still says permission denied...

  4. #4
    Developer
    Join Date
    Oct 2009
    Posts
    23
    Thanks
    0
    Thanked 13 Times in 4 Posts

    It's not saying 'killed' is it? If so, sign it with "ldid -S appname".
    Just out of curiosity, what are you wanting to run with this? There may be a better/easier way.

  5. #5
    What's Jailbreak?
    Join Date
    Oct 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Quote Originally Posted by Charybdis View Post
    It's not saying 'killed' is it? If so, sign it with "ldid -S appname".
    Just out of curiosity, what are you wanting to run with this? There may be a better/easier way.
    I definately signed it.. Ok what i'm trying to do is to have a UIButton basically move or copy a file in /Applications/MyApp.app/ into /Library

    There's specific reasons why I have to do it inside an app and not through mobileterminal etc...

  6. #6
    Developer
    Join Date
    Oct 2009
    Posts
    23
    Thanks
    0
    Thanked 13 Times in 4 Posts

    I played around with this a bit and couldn't get anything right off hand, but I wouldn't be surprised if someone has already done this. Check the hackint0sh forums, xsellize forums, or ipodtouchfan forums, they might have something.

  7. #7
    What's Jailbreak?
    Join Date
    Oct 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Quote Originally Posted by Charybdis View Post
    I played around with this a bit and couldn't get anything right off hand, but I wouldn't be surprised if someone has already done this. Check the hackint0sh forums, xsellize forums, or ipodtouchfan forums, they might have something.
    it aint easy lol .. i just saw that ripdev released the source code to icy last night as they went belly up... i'm going to dig thru there code and i'll post anything interesting i find... it should be in there

  8. #8
    Green Apple appleguru's Avatar
    Join Date
    Oct 2009
    Posts
    40
    Thanks
    0
    Thanked 8 Times in 8 Posts

    I'd say run your shell script with NSTask, but that was removed in the iPhone 3.0 OS release I think...

  9. #9
    Green Apple
    Join Date
    Apr 2008
    Posts
    57
    Thanks
    0
    Thanked 13 Times in 7 Posts

    why not make a toggle in SB Settings? there is a SDK available.

  10. #10
    Green Apple fubaya's Avatar
    Join Date
    Nov 2009
    Posts
    55
    Thanks
    0
    Thanked 22 Times in 18 Posts

    permission denied sounds like it's not executable. Have you checked that?

    Does the script work when ran from MobileTerminal?

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts