␊ |
#import "PartitionInfoElement.h"␊ |
#import "ShellProcess.h"␊ |
#include "string_util.h"␊ |
␊ |
static NSUInteger sHdRedirTable[MAX_HD];␊ |
␊ |
@implementation PartitionInfoElement␊ |
␊ |
@synthesize descDict, bsdName, vUUID, vKind, vName, vPath, mediaPath, mediaRemovable, devInternal, devProtocol;␊ |
@synthesize vAliasName, hidden;␊ |
@synthesize vAliasName, hidden, bootInfo;␊ |
␊ |
/// Create a list of all bsd partitions␊ |
+(NSArray*) createBSDPartitionList␊ |
|
␉return arr;␊ |
}␊ |
␊ |
/// Get the boot information string, for chameleon only for now ...␊ |
-(NSString*) bootDescription␊ |
{␊ |
NSString* extractCmd = @"test -f \"%@boot\" && strings \"%@boot\" | sed -nE 's!^Darwin/x86 boot.+(Chameleon.+)!\\1!p'";␊ |
NSString* extractCmd2 = @"test -f \"%@mach_kernel\" && strings \"%@mach_kernel\" | sed -nE 's!^(Darwin Kernel Version.+)(\\: .*$)!\\1!p'";␊ |
NSString* localPath = [[self.vPath ␊ |
stringByReplacingOccurrencesOfString: @"file://localhost"␊ |
withString:@""] ␊ |
stringByReplacingOccurrencesOfString:@"%20" withString:@" "];␊ |
␊ |
NSString* shellCmd = [NSString stringWithFormat:extractCmd, localPath, localPath ];␊ |
NSString* shellCmd2 = [NSString stringWithFormat:extractCmd2, localPath, localPath ];␊ |
std::string line = trim(ShellProcess([shellCmd UTF8String]).get_line(),"\n");␊ |
␊ |
if (line.length()>0)␊ |
{␊ |
return [NSString stringWithUTF8String:line.c_str()];␊ |
}␊ |
else if ( (line=trim(ShellProcess([shellCmd2 UTF8String]).get_line(),"\n")).length()>0)␊ |
{␊ |
return [NSString stringWithUTF8String:line.c_str()];␊ |
}␊ |
else␊ |
return @"Unknown booter version";␊ |
}␊ |
␊ |
␊ |
/// redirection table for disk swapping␊ |
+(NSUInteger*) hdRedirTable␊ |
{␊ |