Commit 321a1633 authored by thakis@chromium.org's avatar thakis@chromium.org

mac: Change gcapi to not install keystone

A follow-up change will change gcapi to always install chrome
as current user (as determined by the CGSession owner), so that
chrome can set up user keystone itself on first run.

Also change the supported OS X versions from 10.5+ to 10.6-10.8.

BUG=128462

Review URL: https://chromiumcodereview.appspot.com/10854100

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151119 0039d316-1c4b-4281-b951-d872f2087c98
parent 8e34fa1d
...@@ -34,7 +34,7 @@ NSString* const kChannelKey = @"KSChannelID"; ...@@ -34,7 +34,7 @@ NSString* const kChannelKey = @"KSChannelID";
NSString* const kVersionKey = @"KSVersion"; NSString* const kVersionKey = @"KSVersion";
// Condensed from chromium's base/mac/mac_util.mm. // Condensed from chromium's base/mac/mac_util.mm.
bool IsOSXLeopardOrLater() { bool IsOSXVersionSupported() {
// On 10.6, Gestalt() was observed to be able to spawn threads (see // On 10.6, Gestalt() was observed to be able to spawn threads (see
// http://crbug.com/53200). Don't call Gestalt(). // http://crbug.com/53200). Don't call Gestalt().
struct utsname uname_info; struct utsname uname_info;
...@@ -56,7 +56,8 @@ bool IsOSXLeopardOrLater() { ...@@ -56,7 +56,8 @@ bool IsOSXLeopardOrLater() {
// 10.2. // 10.2.
int mac_os_x_minor_version = darwin_major_version - 4; int mac_os_x_minor_version = darwin_major_version - 4;
return mac_os_x_minor_version >= 5; // Chrome is known to work on 10.6 - 10.8.
return mac_os_x_minor_version >= 6 && mac_os_x_minor_version <= 8;
} }
enum TicketKind { enum TicketKind {
...@@ -204,44 +205,6 @@ NSString* PathToInstallScript(NSString* app_path, NSDictionary* info_plist) { ...@@ -204,44 +205,6 @@ NSString* PathToInstallScript(NSString* app_path, NSDictionary* info_plist) {
@"Resources/install.sh"]; @"Resources/install.sh"];
} }
NSString* PathToKeystoneResources(
NSString* app_path, NSDictionary* info_plist) {
return [PathToFramework(app_path, info_plist) stringByAppendingPathComponent:
@"Frameworks/KeystoneRegistration.framework/Resources"];
}
NSString* FindOrInstallKeystone(NSString* app_path, NSDictionary* info_plist) {
NSString* ks_path = kSystemKsadminPath;
// Use user Keystone only if system Keystone doesn't exist /
// isn't accessible.
if (geteuid() != 0 &&
![[NSFileManager defaultManager] isExecutableFileAtPath:ks_path]) {
ks_path = [kUserKsadminPath stringByExpandingTildeInPath];
}
// Always run install.py. It won't overwrite an existing keystone, but
// it might update it or repair a broken existing installation.
NSString* ks_resources = PathToKeystoneResources(app_path, info_plist);
NSString* ks_install =
[ks_resources stringByAppendingPathComponent:@"install.py"];
NSString* ks_tbz =
[ks_resources stringByAppendingPathComponent:@"Keystone.tbz"];
@try {
NSTask* task = [[[NSTask alloc] init] autorelease];
[task setLaunchPath:ks_install];
[task setArguments:@[@"--install", ks_tbz]];
[task launch];
[task waitUntilExit];
if ([task terminationStatus] == 0)
return ks_path;
}
@catch (id exception) {
// Ignore.
}
return nil;
}
bool isbrandchar(int c) { bool isbrandchar(int c) {
// Always four upper-case alpha chars. // Always four upper-case alpha chars.
return c >= 'A' && c <= 'Z'; return c >= 'A' && c <= 'Z';
...@@ -254,7 +217,7 @@ int GoogleChromeCompatibilityCheck(unsigned* reasons) { ...@@ -254,7 +217,7 @@ int GoogleChromeCompatibilityCheck(unsigned* reasons) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
if (!IsOSXLeopardOrLater()) if (!IsOSXVersionSupported())
local_reasons |= GCCC_ERROR_OSNOTSUPPORTED; local_reasons |= GCCC_ERROR_OSNOTSUPPORTED;
if (HasChromeTicket(kSystemTicket)) if (HasChromeTicket(kSystemTicket))
...@@ -328,38 +291,6 @@ int InstallGoogleChrome(const char* source_path, ...@@ -328,38 +291,6 @@ int InstallGoogleChrome(const char* source_path,
if (master_prefs_contents) if (master_prefs_contents)
WriteMasterPrefs(master_prefs_contents, master_prefs_contents_size); WriteMasterPrefs(master_prefs_contents, master_prefs_contents_size);
// Install Keystone if necessary.
if (NSString* keystone = FindOrInstallKeystone(app_path, info_plist)) {
// Register Chrome with Keystone.
@try {
NSTask* task = [[[NSTask alloc] init] autorelease];
[task setLaunchPath:keystone];
NSString* tag = [info_plist objectForKey:kChannelKey];
[task setArguments:@[
@"--register",
@"--productid", [info_plist objectForKey:@"KSProductID"],
@"--version", [info_plist objectForKey:kVersionKey],
@"--xcpath", kChromeInstallPath,
@"--url", [info_plist objectForKey:@"KSUpdateURL"],
@"--tag", tag ? tag : @"", // Stable channel
@"--tag-path", info_plist_path,
@"--tag-key", kChannelKey,
@"--brand-path", brand_path ? brand_path : @"",
@"--brand-key", brand_path ? kBrandKey: @"",
@"--version-path", info_plist_path,
@"--version-key", kVersionKey,
]];
[task launch];
[task waitUntilExit];
}
@catch (id exception) {
// Chrome will try to register keystone on launch.
}
}
// TODO Set default browser if requested. Will be tricky when running as // TODO Set default browser if requested. Will be tricky when running as
// root. // root.
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment