Changeset 16198e3 in nscp


Ignore:
Timestamp:
11/14/11 23:56:33 (18 months ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
96c1461
Parents:
d48afa1
Message:
  • Fixed issue with installer not saving nsc.ini when upgrading from 0.3.9
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • changelog

    rb24c97f r16198e3  
    55 * Fixa dependonservice LanManWorkStation (old win) 
    66 * Fix RtlStringFromGUID problem on NT4 
     7 
     82011-11-14 MickeM 
     9 * Fixed issue with installer not saving nsc.ini when upgrading from 0.3.9 
    710 
    8112011-11-09 MickeM 
  • helpers/installer-dlls/main_dll/main_dll.cpp

    ra78a985 r16198e3  
    5252  } 
    5353  virtual void debug(std::string file, int line, std::wstring message) { 
     54    h->logMessage(_T("DEBUG: ") + message); 
    5455    debug_log.push_back(_T("DEBUG: ") + message); 
    5556  } 
     
    159160      return ERROR_SUCCESS; 
    160161    } 
     162 
     163    boost::filesystem::wpath restore_path = h.getTempPath(); 
     164    restore_path = restore_path / (_T("old_nsc.ini")); 
     165    boost::filesystem::wpath old_path = target; 
     166    old_path = old_path / (_T("nsc.ini")); 
     167 
     168    h.logMessage(_T("Looking for old settings file (for archiving): ") + old_path.string()); 
     169    h.logMessage(_T("Using restore path: ") + restore_path.string()); 
     170    if (boost::filesystem::exists(old_path)) { 
     171      h.logMessage(_T("Found old file: ") + strEx::itos(boost::filesystem::file_size(old_path))); 
     172      h.setProperty(_T("RESTORE_FILE"), restore_path.string()); 
     173      copy_file(h, old_path.string(), restore_path.string()); 
     174    } 
     175    if (boost::filesystem::exists(restore_path)) 
     176      h.logMessage(_T("Found restore file: ") + strEx::itos(boost::filesystem::file_size(restore_path))); 
    161177 
    162178    installer_settings_provider provider(&h, target, map_data); 
     
    228244    } 
    229245    settings_manager::destroy_settings(); 
    230  
    231246  } catch (installer_exception e) { 
    232247    h.logMessage(_T("Failed to read old configuration file: ") + e.what()); 
     
    278293    data.write_string(h.getTargetPath(_T("INSTALLLOCATION"))); 
    279294    data.write_string(h.getPropery(_T("CONFIGURATION_TYPE"))); 
     295    data.write_string(h.getPropery(_T("RESTORE_FILE"))); 
    280296    data.write_int(h.getPropery(_T("ADD_DEFAULTS"))==_T("1")?1:0); 
    281297 
     
    326342    std::wstring target = data.get_next_string(); 
    327343    std::wstring context = data.get_next_string(); 
     344    std::wstring restore = data.get_next_string(); 
    328345    int add_defaults = data.get_next_int(); 
    329346 
    330     //std::wstring map_data = read_map_data(h); 
     347    h.logMessage(_T("Target: ") + target); 
     348    h.logMessage(_T("Context: ") + context); 
     349    h.logMessage(_T("Restore: ") + restore); 
     350 
     351    boost::filesystem::wpath path = target; 
     352    boost::filesystem::wpath old_path = path / _T("nsc.ini.old"); 
     353    path = path / _T("nsc.ini"); 
     354 
     355    boost::filesystem::wpath restore_path = restore; 
     356 
     357    if (boost::filesystem::exists(old_path)) 
     358      h.logMessage(_T("Found old (.old) file: ") + strEx::itos(boost::filesystem::file_size(old_path))); 
     359    if (boost::filesystem::exists(path)) 
     360      h.logMessage(_T("Found old file: ") + strEx::itos(boost::filesystem::file_size(path))); 
     361    if (boost::filesystem::exists(restore_path)) 
     362      h.logMessage(_T("Found restore file: ") + strEx::itos(boost::filesystem::file_size(restore_path))); 
     363 
     364    if (boost::filesystem::exists(restore_path)) { 
     365      if (!boost::filesystem::exists(path)) { 
     366        h.logMessage(_T("Restoring nsc.ini configuration file")); 
     367        copy_file(h, restore_path.string(), path.string()); 
     368      } 
     369      if (!boost::filesystem::exists(old_path)) { 
     370        h.logMessage(_T("Creating backup nsc.ini.old configuration file")); 
     371        copy_file(h, restore_path.string(), old_path.string()); 
     372      } 
     373    } 
     374 
     375    if (boost::filesystem::exists(path)) 
     376      h.logMessage(_T("Size (001): ") + strEx::itos(boost::filesystem::file_size(path))); 
    331377 
    332378    installer_settings_provider provider(&h, target); 
     
    335381      return ERROR_INSTALL_FAILURE; 
    336382    } 
     383    if (boost::filesystem::exists(path)) 
     384      h.logMessage(_T("Size (002): ") + strEx::itos(boost::filesystem::file_size(path))); 
     385 
    337386    h.logMessage(_T("Switching to: ") + context); 
    338387    settings_manager::change_context(context); 
     388    if (boost::filesystem::exists(path)) 
     389      h.logMessage(_T("Size (003): ") + strEx::itos(boost::filesystem::file_size(path))); 
    339390 
    340391    while (data.has_more()) { 
     
    354405      } 
    355406    } 
     407    if (boost::filesystem::exists(path)) 
     408      h.logMessage(_T("Size (004): ") + strEx::itos(boost::filesystem::file_size(path))); 
    356409    settings_manager::get_settings()->save(); 
     410    if (boost::filesystem::exists(path)) 
     411      h.logMessage(_T("Size (005): ") + strEx::itos(boost::filesystem::file_size(path))); 
    357412  } catch (installer_exception e) { 
    358413    h.errorMessage(_T("Failed to write configuration: ") + e.what()); 
  • version.hpp

    rd48afa1 r16198e3  
    11#ifndef VERSION_HPP 
    22#define VERSION_HPP 
    3 #define PRODUCTVER     0,4,0,108 
    4 #define STRPRODUCTVER  "0,4,0,108" 
    5 #define STRPRODUCTDATE "2011-11-13" 
     3#define PRODUCTVER     0,4,0,111 
     4#define STRPRODUCTVER  "0,4,0,111" 
     5#define STRPRODUCTDATE "2011-11-14" 
    66#endif // VERSION_HPP 
  • version.txt

    rd48afa1 r16198e3  
    11version=0.4.0 
    2 build=108 
    3 date=2011-11-13 
     2build=111 
     3date=2011-11-14 
Note: See TracChangeset for help on using the changeset viewer.