diff --git a/config/InstallVariant.info b/config/InstallVariant.info new file mode 100644 index 00000000..7a99f6fd --- /dev/null +++ b/config/InstallVariant.info @@ -0,0 +1 @@ +014EDEDF-E632-4E53-AAEC-B4FC8AF1E72D \ No newline at end of file diff --git a/installer/mac/postinstall.sh b/installer/mac/postinstall.sh index 8814195f..ead322c4 100755 --- a/installer/mac/postinstall.sh +++ b/installer/mac/postinstall.sh @@ -4,8 +4,10 @@ settingsFilePath='/tmp/sym_settings.txt' permissionsFilePath='/tmp/sym_permissions.txt' installPath="$2" -configPath="/Symphony.app/Contents/config/Symphony.config" -newPath=${installPath}${configPath} +configPath="/Symphony.app/Contents/config" +configFilePath="${installPath}${configPath}/Symphony.config" +installVariantPath="${installPath}${configPath}/InstallVariant.info" +newPath=${configFilePath} ## Get Symphony Settings from the temp file ## pod_url=$(sed -n '1p' ${settingsFilePath}); @@ -62,3 +64,5 @@ sed -i "" -E "s#\"openExternal\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"o ## Remove the temp settings & permissions file created ## rm -f ${settingsFilePath} rm -f ${permissionsFilePath} + +uuidgen > ${installVariantPath} \ No newline at end of file diff --git a/installer/win/Symphony-x64.aip b/installer/win/Symphony-x64.aip index b7e60907..cfaa99e0 100644 --- a/installer/win/Symphony-x64.aip +++ b/installer/win/Symphony-x64.aip @@ -30,6 +30,7 @@ + @@ -164,6 +165,7 @@ + @@ -176,7 +178,7 @@ - + @@ -448,7 +450,7 @@ - + @@ -534,9 +536,9 @@ - - - + + + @@ -544,6 +546,8 @@ + + @@ -556,6 +560,7 @@ + @@ -583,6 +588,7 @@ + @@ -691,8 +697,10 @@ + + diff --git a/package.json b/package.json index 5e2780b4..bd2c6ff6 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "extraFiles": [ "config/Symphony.config", "config/titleBarStyles.css", + "config/InstallVariant.info", "dictionaries/**", "library/libsymphonysearch.dylib", "library/indexvalidator.exec", diff --git a/src/app/config-handler.ts b/src/app/config-handler.ts index a4a65145..15172e44 100644 --- a/src/app/config-handler.ts +++ b/src/app/config-handler.ts @@ -37,6 +37,7 @@ export interface IConfig { notificationSettings: INotificationSetting; mainWinPos?: ICustomRectangle; locale?: string; + installVariant?: string; } export interface IGlobalConfig { @@ -113,7 +114,10 @@ class Config { public cloudConfig: ICloudConfig | {}; public filteredCloudConfig: ICloudConfig | {}; private isFirstTime: boolean = true; + private installVariant: string | undefined; private readonly configFileName: string; + private readonly installVariantFilename: string; + private readonly installVariantPath: string; private readonly userConfigPath: string; private readonly appPath: string; private readonly globalConfigPath: string; @@ -121,6 +125,7 @@ class Config { constructor() { this.configFileName = 'Symphony.config'; + this.installVariantFilename = 'InstallVariant.info'; this.userConfigPath = path.join(app.getPath('userData'), this.configFileName); this.cloudConfigPath = path.join(app.getPath('userData'), 'cloudConfig.config'); this.appPath = isDevEnv ? app.getAppPath() : path.dirname(app.getPath('exe')); @@ -128,8 +133,13 @@ class Config { ? path.join(this.appPath, path.join('config', this.configFileName)) : path.join(this.appPath, (isMac) ? '..' : '', 'config', this.configFileName); + this.installVariantPath = isDevEnv + ? path.join(this.appPath, path.join('config', this.installVariantFilename)) + : path.join(this.appPath, (isMac) ? '..' : '', 'config', this.installVariantFilename); + if (isLinux) { this.globalConfigPath = path.join(this.appPath, (isElectronQA) ? '..' : '', 'config', this.configFileName); + this.installVariantPath = path.join(this.appPath, (isElectronQA) ? '..' : '', 'config', this.installVariantFilename); } this.globalConfig = {}; @@ -138,6 +148,7 @@ class Config { this.filteredCloudConfig = {}; this.readUserConfig(); this.readGlobalConfig(); + this.readInstallVariant(); this.readCloudConfig(); this.checkFirstTimeLaunch(); @@ -263,10 +274,11 @@ class Config { ...filteredFields }: IConfig = this.userConfig as IConfig; // update to the new build number filteredFields.buildNumber = buildNumber; + filteredFields.installVariant = this.installVariant; logger.info(`config-handler: setting first time launch for build`, buildNumber); return await this.updateUserConfig(filteredFields); } - await this.updateUserConfig({ buildNumber }); + await this.updateUserConfig({ buildNumber, installVariant: this.installVariant }); } /** @@ -332,6 +344,14 @@ class Config { logger.info(`config-handler: Global configuration: `, this.globalConfig); } + /** + * Reads the install variant from a file + */ + private readInstallVariant() { + this.installVariant = fs.readFileSync(this.installVariantPath, 'utf8'); + logger.info(`config-handler: Install variant: `, this.installVariant); + } + /** * Reads and stores the cloud config file * @@ -354,20 +374,20 @@ class Config { */ private async checkFirstTimeLaunch() { logger.info('config-handler: checking first time launch'); - const configBuildNumber = this.userConfig && (this.userConfig as IConfig).buildNumber || null; + const installVariant = this.userConfig && (this.userConfig as IConfig).installVariant || null; - if (!configBuildNumber) { - logger.info(`config-handler: there's no build number found, this is a first time launch`); + if (!installVariant) { + logger.info(`config-handler: there's no install variant found, this is a first time launch`); this.isFirstTime = true; return; } - if (configBuildNumber && typeof configBuildNumber === 'string' && configBuildNumber !== buildNumber) { - logger.info(`config-handler: build number found is of an older build, this is a first time launch`); + if (installVariant && typeof installVariant === 'string' && installVariant !== this.installVariant) { + logger.info(`config-handler: install variant found is of a different instance, this is a first time launch`); this.isFirstTime = true; return; } - logger.info(`config-handler: build number is the same as the previous build, not a first time launch`); + logger.info(`config-handler: install variant is the same as the existing one, not a first time launch`); this.isFirstTime = false; } }