Sorry for spamming this on like all the iPhone Dev forums, but...well I can't find any info on it, and I'd like to know before I shell out to buy a mac for the iPhone SDK. Basically I am wondering if it is possible to run a console script (.sh) from an iPhone App. The script is written to download a program from a repository that I set up, respring, then after a set time delete the program and respring again, so it needs root privileges, and is interactive in that the user can set how long the program will be kept. I have the bash script written, and it works fine when called from mobile terminal, but is there any way to do this from within a (jailbroken) app (without using mobile terminal / SSH / Bossprefs)? Or is there an overall better way to achieve this?
Thanks
Sorry for spamming this on like all the iPhone Dev forums, but...well I can't find any info on it, and I'd like to know before I shell out to buy a mac for the iPhone SDK. Basically I am wondering if it is possible to run a console script (.sh) from an iPhone App. The script is written to download a program from a repository that I set up, respring, then after a set time delete the program and respring again, so it needs root privileges, and is interactive in that the user can set how long the program will be kept. I have the bash script written, and it works fine when called from mobile terminal, but is there any way to do this from within a (jailbroken) app (without using mobile terminal / SSH / Bossprefs)? Or is there an overall better way to achieve this?
Thanks
I don't have any solution for you, but I'm really interested by your script as I need to write exactly the same one, and I don't know how to write shell scripts. So.. i fyou could help me (or post your script here...) that would be marvelous for me!
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
#check for root privileges
if [ $UID -ne 0 ]; then
echo Please, type root password...
su -c $0 $@
exit
fi
echo "WARNING: This Program will shutdown and delete Program when the allotted time has expired."
echo "Please be sure to save your work before then"
echo "How many minutes will you use this program?"
read response
#retrieve yourApp (insert desired app name) from repos
echo y | apt-get install com.<developer>.<yourApp>
#respring
launchctl stop com.apple.SpringBoard
sleep "$((response * 60))";
#removed app after allotted time
apt-get -y remove com.RCM.CitrixReciever
launchctl stop com.apple.SpringBoard
note that for now this must be run either with mobileTerminal or via ssh, as it is a console script. I've made a bit of headway with launching it from the springboard, I'll probably use fopen() to do it. I'll post back if I get it figured out. Let me know if you've got any questions about the script
Writing code is not only about writing instructions to a machine / computer, but also about writing something that could be read, understood, and maintained by others. That's why, I like Cocoa.