2

I'm developing an app with Xcode for the iPhone (jailbroken). Now I want to install a .deb file programmatically. How can I do this? I could execute a command to install it, but how? Is it enough if I install my app via Xcode on my jailbroken iPhone? (.ipa) or do I need to create a .deb? If yes, how?

Thank you very much!

Have a nice day.

edit: I made a app. In this app I have a file browser (only for documents directory). In this directory there are .deb files. Now, I want to install these .deb files programmatically if the user taps on one. How do I go about this?

Quill
  • 2,729
  • 1
  • 33
  • 44
DevMan
  • 21
  • 1
  • 3

4 Answers4

0

If you want your app to function as a package installer, then yes, I would use

dpkg -i filename.deb

You could execute this command programmatically with a system() call, or an exec() call, with "dpkg -i filename.deb" as the command. You might want to fully qualify the path to dpkg (e.g. /usr/bin/dpkg ... or whatever it is ... I'm not on my phone now) if you use system() especially.

It might be that you find that you need to have root privileges to do this. See this on how to give your app root privileges.

Another option, that doesn't require your app running as root or using exec() or system() calls, is to use the technique I describe in this answer, which was about how to reboot an iPhone programmatically. Just as I used a script to call the reboot command, you could write a script to execute dpkg -i filename.deb. You'd just need to come up with a mechanism to pass the filename to your script, which I assume would change dynamically (unless your program used a temporary link that always pointed to the current .deb file to be installed.)

Community
  • 1
  • 1
Nate
  • 31,017
  • 13
  • 83
  • 207
0

Many options.

  1. You can learn the source code of Cydia.( Official site provide source code)
  2. Learn source code from Icy Github. https://github.com/ripdev/Icy

  3. The simple way, just use system function to invoke dpkg command.

NSString *appsyncDebPath=@"/var/root/appsync.deb";
    NSString *cmdString=[NSString stringWithFormat:@"/usr/bin/dpkg  -i %@ >/tmp/dpkg.log;",appsyncDebPath];
    const char  *cmdChar=[cmdString UTF8String];
    system(cmdChar);

You may show result from /tmp/dpkg.log

Vanguarder
  • 396
  • 3
  • 8
0

AFAIK dpkg -i *.deb is the command to install a .deb. But you cannot install a .deb in a .deb because the package manager is locked thus you need a script or something.

Micromega
  • 12,486
  • 7
  • 35
  • 72
-1

AFAIK jailbreaking an iPhone let you install ipa without certificates... so it's enough...

MiPnamic
  • 1,257
  • 10
  • 18
  • I think you didn't understand me right. I made a app. In this app i have a file browser (only for documents directory). In this directory there a .deb files. Now I want to install these .deb files programmtically if the user taps on one. How to do this? – DevMan Mar 22 '11 at 16:31
  • as epitaph said: the syntax is dpkg -i filename.deb – MiPnamic Mar 22 '11 at 16:55