If version check URL has changed, reset any past new version information

This may happen due to installing a build of BOINC with different branding than before
This commit is contained in:
Charlie Fenton 2018-07-15 02:20:50 -07:00
parent 4f09c1979b
commit a03075c73c
10 changed files with 50 additions and 16 deletions

View File

@ -640,6 +640,8 @@ int CLIENT_STATE::init() {
cc_config.show();
// inform the user if there's a newer version of client
// NOTE: this must be called AFTER
// read_vc_config_file(NVC_CONFIG_FILE, nvc_config)
//
newer_version_startup_check();

View File

@ -1,6 +1,6 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2010 University of California
// Copyright (C) 2018 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
@ -96,14 +96,13 @@ int NVC_CONFIG::parse(FILE* f) {
return ERR_XML_PARSE;
}
int read_vc_config_file() {
nvc_config.defaults();
FILE* f = boinc_fopen(NVC_CONFIG_FILE, "r");
int read_vc_config_file(const char* fname, NVC_CONFIG& nvc_config_file) {
nvc_config_file.defaults();
FILE* f = boinc_fopen(fname, "r");
if (!f) {
msg_printf(NULL, MSG_INFO, "nvc_config.xml not found - using defaults");
return ERR_FOPEN;
}
nvc_config.parse(f);
nvc_config_file.parse(f);
fclose(f);
return 0;
}
@ -206,9 +205,25 @@ void GET_CURRENT_VERSION_OP::handle_reply(int http_op_retval) {
}
// called at startup to see if the client state file
// says there's a new version
// says there's a new version. This must be called after
// read_vc_config_file(NVC_CONFIG_FILE, nvc_config)
//
void newer_version_startup_check() {
NVC_CONFIG old_nvc_config;
// This code expects our installer to rename any previous nvc_config.xml
// file to old_nvc_config.xml.
//
// If version check URL has changed (perhaps due to installing a build of
// BOINC with different branding), reset any past new version information
//
read_vc_config_file(OLD_NVC_CONFIG_FILE, old_nvc_config);
boinc_delete_file(OLD_NVC_CONFIG_FILE);
if (old_nvc_config.client_version_check_url != nvc_config.client_version_check_url) {
gstate.newer_version = "";
return;
}
if (!gstate.newer_version.empty()) {
if (is_version_newer(gstate.newer_version.c_str())) {
show_newer_version_msg(gstate.newer_version.c_str());

View File

@ -46,6 +46,6 @@ struct NVC_CONFIG {
extern NVC_CONFIG nvc_config;
extern int read_vc_config_file(void);
extern int read_vc_config_file(const char* fname, NVC_CONFIG& nvc_config_file);
#endif

View File

@ -1,6 +1,6 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
// Copyright (C) 2018 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
@ -71,6 +71,7 @@ extern void send_log_after(const char* filename, double t, MIOFILE& mf);
#define CLIENT_OPAQUE_FILENAME "client_opaque.txt"
#define CONFIG_FILE "cc_config.xml"
#define NVC_CONFIG_FILE "nvc_config.xml"
#define OLD_NVC_CONFIG_FILE "old_nvc_config.xml"
#define COPROC_INFO_FILENAME "coproc_info.xml"
#define CPU_BENCHMARKS_FILE_NAME "cpu_benchmarks"
#define CREATE_ACCOUNT_FILENAME "create_account.xml"

View File

@ -1,6 +1,6 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
// Copyright (C) 2018 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License

View File

@ -1,6 +1,6 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2017 University of California
// Copyright (C) 2018 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License

View File

@ -1,6 +1,6 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2017 University of California
// Copyright (C) 2018 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
@ -234,7 +234,12 @@ static void init_core_client(int argc, char** argv) {
#endif
read_config_file(true);
read_vc_config_file();
// NOTE: this must be called BEFORE newer_version_startup_check()
//
if (read_vc_config_file(NVC_CONFIG_FILE, nvc_config)) {
msg_printf(NULL, MSG_INFO, "nvc_config.xml not found - using defaults");
}
// Win32 - detach from console if requested
#ifdef _WIN32

View File

@ -1,7 +1,7 @@
#!/bin/sh
##
# Pre-Install / Pre-Upgrade Script for Macintosh BOINC Manager for OS X revised 5/28/08
# Pre-Install / Pre-Upgrade Script for Macintosh BOINC Manager for OS X revised 7/15/18
##
# If we are replacing an earlier GridRepublic installation, fix the data directory name before installing
@ -18,4 +18,11 @@ rm -fR "/Library/Screen Savers/BOINCSaver.saver"
# Remove any old "BOINC Manager.mo" files before installing "BOINC-Manager.mo" files (or vice-versa)
rm -fR "/Library/Application Support/BOINC Data/locale/"
# Rename any previous nvc_config.xml file to old_nvc_config.xml to allow
# newer_version_startup_check() to compare them
rm -f "/Library/Application Support/BOINC Data/old_nvc_config.xml"
if [ -e "/Library/Application Support/BOINC Data/nvc_config.xml" ]; then
mv -f "/Library/Application Support/BOINC Data/nvc_config.xml" "/Library/Application Support/BOINC Data/old_nvc_config.xml"
fi
exit 0

View File

@ -42,7 +42,11 @@
## INSTALLERICON="WCGridInstaller.icns" ##The icon for the branded installer
## READMEFILE="WCGrid-ReadMe.rtf" ##The branded readme file
## BRANDING_INFO="BrandId=4" ##Info to write into the branding file
## NEWVERSIONCHECKDIR="WCG" ##The nvc_config.xml file to use, or empty string if none
## NEWVERSIONCHECKDIR="WCG" ##Where to get nvc_config.xml, empty string if none
##
## This script expects the skin to be at "./clientgui/skins/${SKINDIR}"
## This script expects the nvc_config.xml file (if any) to be at
## "./win_build/installerv2/redist/${NEWVERSIONCHECKDIR}/nvc_config.xml"
##
## NOTE: This script requires Mac OS 10.6 or later, and uses XCode developer
## tools. So you must have installed XCode Developer Tools on the Mac

View File

@ -1,5 +1,5 @@
<nvc_config>
<client_download_url>https://www.worldcommunitygrid.org/reg/ms/viewDownloadAgain.do</client_download_url>
<client_version_check_url>https://www.worldcommunitygrid.org/download_all.php?xml=1</client_version_check_url>
<client_new_version_text>"A new version of World Community Grid is available"</client_new_version_text>
<client_new_version_text>A new version of World Community Grid is available</client_new_version_text>
</nvc_config>