Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.
10-23-2009, 05:44 PM #1$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...
NSString* commandToRun = @"/Applications/Test.app/start.sh"; system([commandToRun UTF8String]);
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];
10-25-2009, 12:02 AM #2
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.
10-25-2009, 01:18 PM #3
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...
10-25-2009, 01:21 PM #4
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.
10-25-2009, 04:49 PM #5
10-25-2009, 05:53 PM #6
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.
10-26-2009, 06:14 AM #7
10-28-2009, 11:22 PM #8
I'd say run your shell script with NSTask, but that was removed in the iPhone 3.0 OS release I think...
11-07-2009, 09:55 PM #9
why not make a toggle in SB Settings? there is a SDK available.
11-08-2009, 06:25 PM #10
permission denied sounds like it's not executable. Have you checked that?
Does the script work when ran from MobileTerminal?