1

我正在为越狱的 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/'}
4

2 回答 2

0

尝试使用

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

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

于 2012-07-27T19:00:20.417 回答
0

使用以下代码

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);
于 2012-08-03T05:23:52.533 回答