mirror of https://github.com/BOINC/boinc.git
Merge branch 'master' of https://github.com/BOINC/boinc
This commit is contained in:
commit
3b7969b1fd
|
@ -349,6 +349,34 @@ void CLIENT_STATE::set_now() {
|
|||
now = x;
|
||||
}
|
||||
|
||||
// Check if version or platform has changed;
|
||||
// if so we're running a different client than before.
|
||||
//
|
||||
bool CLIENT_STATE::is_new_client() {
|
||||
bool new_client = false;
|
||||
if ((core_client_version.major != old_major_version)
|
||||
|| (core_client_version.minor != old_minor_version)
|
||||
|| (core_client_version.release != old_release)
|
||||
) {
|
||||
msg_printf(NULL, MSG_INFO,
|
||||
"Version change (%d.%d.%d -> %d.%d.%d)",
|
||||
old_major_version, old_minor_version, old_release,
|
||||
core_client_version.major,
|
||||
core_client_version.minor,
|
||||
core_client_version.release
|
||||
);
|
||||
new_client = true;
|
||||
}
|
||||
if (statefile_platform_name.size() && strcmp(get_primary_platform(), statefile_platform_name.c_str())) {
|
||||
msg_printf(NULL, MSG_INFO,
|
||||
"Platform changed from %s to %s",
|
||||
statefile_platform_name.c_str(), get_primary_platform()
|
||||
);
|
||||
new_client = true;
|
||||
}
|
||||
return new_client;
|
||||
}
|
||||
|
||||
int CLIENT_STATE::init() {
|
||||
int retval;
|
||||
unsigned int i;
|
||||
|
@ -506,6 +534,8 @@ int CLIENT_STATE::init() {
|
|||
//
|
||||
parse_state_file();
|
||||
|
||||
bool new_client = is_new_client();
|
||||
|
||||
// this follows parse_state_file() since we need to have read
|
||||
// domain_name for Android
|
||||
//
|
||||
|
@ -590,31 +620,6 @@ int CLIENT_STATE::init() {
|
|||
}
|
||||
do_cmdline_actions();
|
||||
|
||||
// check if version or platform has changed.
|
||||
// Either of these is evidence that we're running a different
|
||||
// client than previously.
|
||||
//
|
||||
bool new_client = false;
|
||||
if ((core_client_version.major != old_major_version)
|
||||
|| (core_client_version.minor != old_minor_version)
|
||||
|| (core_client_version.release != old_release)
|
||||
) {
|
||||
msg_printf(NULL, MSG_INFO,
|
||||
"Version change (%d.%d.%d -> %d.%d.%d)",
|
||||
old_major_version, old_minor_version, old_release,
|
||||
core_client_version.major,
|
||||
core_client_version.minor,
|
||||
core_client_version.release
|
||||
);
|
||||
new_client = true;
|
||||
}
|
||||
if (statefile_platform_name.size() && strcmp(get_primary_platform(), statefile_platform_name.c_str())) {
|
||||
msg_printf(NULL, MSG_INFO,
|
||||
"Platform changed from %s to %s",
|
||||
statefile_platform_name.c_str(), get_primary_platform()
|
||||
);
|
||||
new_client = true;
|
||||
}
|
||||
// if new version of client,
|
||||
// - run CPU benchmarks
|
||||
// - get new project list
|
||||
|
|
|
@ -247,6 +247,7 @@ struct CLIENT_STATE {
|
|||
// --------------- client_state.cpp:
|
||||
CLIENT_STATE();
|
||||
void show_host_info();
|
||||
bool is_new_client();
|
||||
int init();
|
||||
bool poll_slow_events();
|
||||
// Never blocks.
|
||||
|
|
|
@ -1224,33 +1224,47 @@ bool isDualGPUMacBook() {
|
|||
|
||||
// see if Virtualbox is installed
|
||||
//
|
||||
static const struct dir_vbox_locations {
|
||||
const char *dir;
|
||||
} vbox_locations[] = {
|
||||
{ "/usr/bin/VboxManage" },
|
||||
{ "/usr/local/bin/VboxManage" },
|
||||
// add other ifdefs here as necessary.
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
int HOST_INFO::get_virtualbox_version() {
|
||||
char path[MAXPATHLEN];
|
||||
char cmd [MAXPATHLEN+35];
|
||||
char buf[256];
|
||||
int i = 0;
|
||||
FILE* fd;
|
||||
|
||||
safe_strcpy(path, "/usr/bin/VBoxManage");
|
||||
do {
|
||||
safe_strcpy(path, vbox_locations[i].dir);
|
||||
|
||||
if (boinc_file_exists(path)) {
|
||||
if (access(path, X_OK)) {
|
||||
return 0;
|
||||
}
|
||||
safe_strcpy(cmd, path);
|
||||
safe_strcat(cmd, " --version");
|
||||
fd = popen(cmd, "r");
|
||||
if (fd) {
|
||||
if (fgets(buf, sizeof(buf), fd)) {
|
||||
strip_whitespace(buf);
|
||||
int n, a,b,c;
|
||||
n = sscanf(buf, "%d.%d.%d", &a, &b, &c);
|
||||
if (n == 3) {
|
||||
strcpy(virtualbox_version, buf);
|
||||
}
|
||||
}
|
||||
pclose(fd);
|
||||
}
|
||||
}
|
||||
if (boinc_file_exists(path)) {
|
||||
if (access(path, X_OK)) {
|
||||
return 0;
|
||||
}
|
||||
safe_strcpy(cmd, path);
|
||||
safe_strcat(cmd, " --version");
|
||||
fd = popen(cmd, "r");
|
||||
if (fd) {
|
||||
if (fgets(buf, sizeof(buf), fd)) {
|
||||
strip_whitespace(buf);
|
||||
int n, a,b,c;
|
||||
n = sscanf(buf, "%d.%d.%d", &a, &b, &c);
|
||||
if (n == 3) {
|
||||
strcpy(virtualbox_version, buf);
|
||||
}
|
||||
}
|
||||
pclose(fd);
|
||||
}
|
||||
}
|
||||
|
||||
++i;
|
||||
} while (vbox_locations[i].dir != NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue