Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
restord: bless the imaged volume (#28)
Browse files Browse the repository at this point in the history
* restord: bless the imaged volume

* only use bless for 10.13.4 hosts

* don't do that
  • Loading branch information
tburgin authored Apr 16, 2018
1 parent 75fea89 commit d226300
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion restord/ImageSessionServer.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ - (void)beginImaging {
// Set imageinfo.plist keys
[self applyImageInfo:mountURL];

[self blessMountURL:mountURL];
[self unmountDisk:disk ?: self.diskRef];
}
if (disk) CFRelease(disk);
Expand Down Expand Up @@ -354,10 +355,13 @@ - (void)processOutput:(NSData *)output {
} else {
[[self.client remoteObjectProxy] imagingPercentage:self.percentage];
}
} else if ([line isEqualToString:@"Personalization over TDM succeeded"]) {
NSLog(@"%@ %@", self, line);
} else if (line.length >= dirtyLine.length &&
![line isEqualToString:@"done"] &&
![line isEqualToString:@"Validating target..."] &&
![line isEqualToString:@"Validating sizes..."]) {
![line isEqualToString:@"Validating sizes..."] &&
![line hasPrefix:@"nx_kernel_mount"]) {
// If line doesn't begin with a tab (an INFO message) and isn't a known info message,
// treat it as an error :-(
NSLog(@"%@ ASR Error: %@", self, line);
Expand Down Expand Up @@ -444,4 +448,15 @@ - (void)applyImageInfo:(NSURL *)mountURL {
}
}

- (void)blessMountURL:(NSURL *)mountURL {
NSOperatingSystemVersion version = {10, 13, 4};
if (![[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:version]) return;
NSTask *bless = [[NSTask alloc] init];
bless.launchPath = @"/usr/sbin/bless";
bless.arguments = @[ @"--folder", mountURL.path ];
[bless launch];
[bless waitUntilExit];
if (bless.terminationStatus != 0) NSLog(@"%@ Failed to bless: %@", self, mountURL.path);
}

@end

0 comments on commit d226300

Please sign in to comment.