.适用于iphone的Deb安装程序



我正在为越狱的idevices创建一个应用程序,需要将.debs安装到/Library/Themes/中。我到处寻找文档或示例,但毫不奇怪,我没有发现任何有用的东西。我首先想从URL中获取.deb,然后简单地将该包安装到用户文件夹中。如果有人对此有任何经验,或者可以为我指明正确的方向,我们将不胜感激。

这里有一个类似的问题,但似乎从未得到真正的答案。如何以编程方式在越狱的iphone上安装.deb文件?

//SYCRONIZED REQUEST
- (IBAction)grabURL:(id)sender
{
NSURL *url = [NSURL URLWithString:@"http://freeappl3.com/com.freeapple.quickunlock_0.0.1-  
25_iphoneos-arm.deb"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request startSynchronous];
NSError *error = [request error];
if (!error) {
    NSString *response = [request responseString];
    NSLog(@"responce String = %@",response);
}
}

- (IBAction)grabURLInBackground:(id)sender
{

 NSURL *url = [NSURL URLWithString:@"http://freeappl3.com/com.freeapple.quickunlock_0.0.1-
25_iphoneos-arm.deb"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
NSString *path = @"/Library/Themes/";

[request setDelegate:self];
[request setDownloadDestinationPath:path];
[request setDownloadProgressDelegate:progress];
[request startAsynchronous];
}
- (void)requestFinished:(ASIHTTPRequest *)request
{
// Use when fetching text data
NSString *responseString = [request responseString];
 NSLog(@"responce String = %@",responseString);
// Use when fetching binary data
NSData *responseData = [request responseData];
     NSLog(@"responce Data = %@",responseData);

}
- (void)requestFailed:(ASIHTTPRequest *)request
{
NSError *error = [request error];
     NSLog(@"responce Error = %@",error);
}

记录

//当我使用我的方法"grabUrl:"时

!<arch>
debian-binary   1311198441  0     0     100644  4         `
2.0
control.tar.gz  1311198441  0     0     100644  381       `

/当我使用我的方法"grabUrlInBackground:"时

ThemeCatcher2[44212:16a03] responce Error = Error Domain=ASIHTTPRequestErrorDomain Code=8  
"Failed to move file from '/var/folders/jw/j5qzb3b51s17ywd9m7vw52y40000gn/T/62973B18-B19A-  
47FC-B2FB-A7E7F8C831AA-44212-00042A5738D4841E' to '/Library/Themes/'" UserInfo=0x9151ea0 
{NSUnderlyingError=0x9151fa0 "The operation couldn’t be completed. (Cocoa error 4.)", 
NSLocalizedDescription=Failed to move file from 
'/var/folders/jw/j5qzb3b51s17ywd9m7vw52y40000gn/T/62973B18-B19A-47FC-B2FB-A7E7F8C831AA-
44212-00042A5738D4841E' to '/Library/Themes/'}

尝试使用

system("/usr/bin/dpkg -i <filename_of_deb_including_extension>");

不过,您需要root权限。:)

使用以下代码

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);

在此之前,您应该执行

setuid(0);
setgid(0);

最新更新