替换开发环境命令;修改系统识别脚本
This commit is contained in:
parent
0b598b9674
commit
7b70d4ea1b
|
@ -472,13 +472,13 @@ class deployWindow {
|
|||
const parentdivshow = document.getElementById('osInfoShow') as HTMLDivElement;
|
||||
parentdiv.innerHTML = "";
|
||||
parentdivshow.innerHTML = "";
|
||||
let osinfo;
|
||||
if (!result.osinfo) {
|
||||
osinfo = `<h3>操作系统信息</h3><p>操作系统检测脚本运行失败,未成功检测到操作系统类型</p>`
|
||||
let osrelease;
|
||||
if (!result.osrelease) {
|
||||
osrelease = `<h3>操作系统信息</h3><p>操作系统检测脚本运行失败,未成功检测到操作系统类型</p>`
|
||||
} else {
|
||||
osinfo = `<h3>操作系统信息</h3><p>已检测到当前操作系统信息为:<span>${result.osinfo}</span></p>`;
|
||||
osrelease = `<h3>操作系统信息</h3><p>已检测到当前操作系统信息为:<span>${result.osrelease}</span></p>`;
|
||||
}
|
||||
parentdiv.innerHTML = osinfo;
|
||||
parentdiv.innerHTML = osrelease;
|
||||
let dataSys = "";
|
||||
let osdiv;
|
||||
osdiv = `<p>判断依据:</p><div><p>cat ${result.osFile}</p>`;
|
||||
|
@ -608,8 +608,8 @@ class deployWindow {
|
|||
console.log("kylinide.installWizard.init.configVersify result is void");
|
||||
return;
|
||||
}
|
||||
console.log("kylinide.installWizard.init configVersify result:" + JSON.stringify(configData));
|
||||
console.log(configData.type + " " + configData.selectPageShow + " " + configData.message);
|
||||
// console.log("kylinide.installWizard.init configVersify result:" + JSON.stringify(configData));
|
||||
// console.log(configData.type + " " + configData.selectPageShow + " " + configData.message);
|
||||
if (configData.selectPageShow) {
|
||||
const onlineUpdateConfig = document.getElementById("onlineUpdateConfig") as HTMLInputElement;
|
||||
const onlineLocalConfig = document.getElementById("onlineLocalConfig") as HTMLInputElement;
|
||||
|
@ -628,6 +628,7 @@ class deployWindow {
|
|||
parentdiv.innerHTML = configData.message;
|
||||
} else if (configData.selectPageShow == 4) {
|
||||
onlineUpdateConfig.checked = true;
|
||||
parentdiv.innerHTML = configData.message;
|
||||
}
|
||||
}
|
||||
if (this.nextBtn && this.prevBtn) {
|
||||
|
@ -1232,13 +1233,10 @@ class EventInvokeCheck {
|
|||
}
|
||||
|
||||
export function startup(configuration: DeployWindowConfiguration): void {
|
||||
console.log("-----------------dll---------head----startupdeploy");
|
||||
// const platformClass = configuration.data.platform === 'win32' ? 'windows' : configuration.data.platform === 'linux' ? 'linux' : 'mac';
|
||||
// mainWindow.document.body.classList.add(platformClass); // used by our fonts
|
||||
// createCodiconStyleSheet();
|
||||
// applyZoom(configuration.data.zoomLevel);
|
||||
|
||||
console.log("-----------------dll-------------startupdeploy");
|
||||
new deployWindow(configuration.windowId);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,17 +66,15 @@ export class DeployMainService implements IDeployMainService {
|
|||
|
||||
private DeployWindow: BrowserWindow | null = null;
|
||||
|
||||
// private sysinfo: installInfo;
|
||||
// private installconfigpath: string;
|
||||
private localConfigObject: { res: number; depConfigInfo: any; g_index_Object: any; osinfo: string; localConfigMatch: number; };
|
||||
// private baseUrl: string = "";
|
||||
private selectObject = {
|
||||
dirPath: "",
|
||||
updateFlag: false,
|
||||
depInfoJsonPath: "", //选中的依赖配置文件路径,
|
||||
extAddressPath: "",//选中的插件配置文件路径
|
||||
}
|
||||
updateConfigObject: { res: number; g_index_Object: any; osinfo: string; ConfigMatch: number; base_url: any; depConfigInfo: any; };
|
||||
};
|
||||
private localConfigObject: { res: number; depConfigInfo: any; g_index_Object: any; osinfo: string; localConfigMatch: number; osrelease: string; supportList: string[] };
|
||||
updateConfigObject: { res: number; g_index_Object: any; osinfo: string; ConfigMatch: number; base_url: any; depConfigInfo: any; osrelease: string; supportList: string[] };
|
||||
|
||||
localConfigDir: any;
|
||||
localConfigPathname: any;
|
||||
installConfig: any;
|
||||
|
@ -122,32 +120,51 @@ export class DeployMainService implements IDeployMainService {
|
|||
private userEnv: IProcessEnvironment,
|
||||
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
|
||||
@ILoggerMainService private readonly loggerMainService: ILoggerMainService,
|
||||
// @ILogService private readonly logService: ILogService,
|
||||
// @IDiagnosticsService private readonly diagnosticsService: IDiagnosticsService,
|
||||
// @IDiagnosticsMainService private readonly diagnosticsMainService: IDiagnosticsMainService,
|
||||
// @IDialogMainService private readonly dialogMainService: IDialogMainService,
|
||||
// @INativeHostMainService private readonly nativeHostMainService: INativeHostMainService,
|
||||
@IProtocolMainService private readonly protocolMainService: IProtocolMainService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
// @IStateService private readonly stateService: IStateService,
|
||||
// @IWindowsMainService private readonly windowsMainService: IWindowsMainService,
|
||||
// @IOpenerService private readonly _openerService: IOpenerService,
|
||||
// @IThemeMainService private readonly themeMainService: IThemeMainService,
|
||||
// @IThemeService private readonly themeService: IThemeService,
|
||||
// @INativeWorkbenchEnvironmentService private readonly environmentService: INativeWorkbenchEnvironmentService,
|
||||
) {
|
||||
// this.sysinfo = { IDEVersion: this.productService.IDEVersion || "", localConfigFile: "", addNewPage: 0, localosinfo: "", urlosinfo: "", urlConfigFile: "" }
|
||||
this.localConfigObject = { depConfigInfo: "", res: 0, g_index_Object: "", osinfo: "", localConfigMatch: 0 };
|
||||
this.updateConfigObject = { res: 0, g_index_Object: {}, osinfo: "", ConfigMatch: 0, base_url: "", depConfigInfo: "" };
|
||||
this.localConfigObject = { depConfigInfo: "", res: 0, g_index_Object: {}, osinfo: "", localConfigMatch: 0, osrelease: "", supportList: [] };
|
||||
this.updateConfigObject = { res: 0, g_index_Object: {}, osinfo: "", ConfigMatch: 0, base_url: "", depConfigInfo: "", osrelease: "", supportList: [] };
|
||||
this.updateConfigDir = installUtils.installConfigDirPre() + "/" + installUtils.getDateDir();
|
||||
this.reset();
|
||||
this.logger = this.loggerMainService.createLogger(URI.file(this.installConfig + "/log/instguide.log"));
|
||||
this.removeListeners();
|
||||
this.registerListeners();
|
||||
}
|
||||
reset() {
|
||||
this.localConfigObject = { depConfigInfo: "", res: 0, g_index_Object: {}, osinfo: "", localConfigMatch: 0 };
|
||||
this.localConfigObject = { depConfigInfo: "", res: 0, g_index_Object: {}, osinfo: "", localConfigMatch: 0, osrelease: "", supportList: [] };
|
||||
this.updateConfigObject = { res: 0, g_index_Object: {}, osinfo: "", ConfigMatch: 0, base_url: "", depConfigInfo: "", osrelease: "", supportList: [] };
|
||||
this.localConfigDir = installUtils.localConfigPath();
|
||||
this.installConfig = installUtils.installConfigDirPre();//.kylin-ide/installconfig
|
||||
this.updateConfigDir = installUtils.installConfigDirPre() + "/" + installUtils.getDateDir();
|
||||
|
||||
this.logFile0 = this.installConfig + '/log/install.1.log';
|
||||
this.resultFile = this.installConfig + '/resultFile';
|
||||
this.extLogFile0 = this.installConfig + '/log/extInstall.1.log';
|
||||
this.logger = this.loggerMainService.createLogger(URI.file(this.installConfig + "/log/installguide.log"));
|
||||
this.removeListeners();
|
||||
this.registerListeners();
|
||||
|
||||
this.baseUrl = "";
|
||||
this.extDownloadPath = "";
|
||||
this.extMap = {};
|
||||
this.depList = [];
|
||||
this.extList = [];
|
||||
this.lastLogPosition = 0;
|
||||
//文件监听;
|
||||
this.installFsWatcher = null;
|
||||
this.extlogFsWatcher = null;
|
||||
this.pkglogFsWatcher = null;
|
||||
//执行安装脚本的进程号;
|
||||
this.installProcessId = null;
|
||||
this.cancelFlag = false;
|
||||
this.offset = 0;
|
||||
this.resultIndex = 0;
|
||||
|
||||
this.flagPkexec = 0;
|
||||
this.lastExtLogPosition = 0;
|
||||
|
||||
this.startInstallDepWatch = 0;
|
||||
|
||||
this.controller = new AbortController();
|
||||
}
|
||||
//#region Register Listeners
|
||||
|
||||
|
@ -200,7 +217,13 @@ export class DeployMainService implements IDeployMainService {
|
|||
let installCommand = "";
|
||||
try {
|
||||
const installItem = this.extDownloadPath + msg.downloadDone;
|
||||
installCommand = "kylin-ide --install-extension " + installItem;
|
||||
if (this.environmentMainService.isBuilt) {
|
||||
installCommand = "kylin-code" + " " + "--install-extension" + " " + installItem;
|
||||
}
|
||||
else {
|
||||
let comandpath = path.join(FileAccess.asFileUri('').fsPath, '..', "scripts/code-cli.sh")
|
||||
installCommand = comandpath + " " + "--install-extension" + " " + installItem;
|
||||
}
|
||||
this.logger.debug("安装 ext installCommand", installCommand);
|
||||
if (this.installQueue.length === 0) {
|
||||
this.installQueue.push({ installCommand, msg });
|
||||
|
@ -438,7 +461,7 @@ export class DeployMainService implements IDeployMainService {
|
|||
if (this.localConfigObject.res != 0 && this.updateConfigObject.res != 0) {
|
||||
if (this.DeployWindow) {
|
||||
if (this.localConfigObject.osinfo == "undefined" && this.updateConfigObject.osinfo == "undefined") {
|
||||
this.logger.error("安装引导器仅支持openKylin操作系统,脚本根据/etc/os-release信息判断操作系统类型");
|
||||
this.logger.error("安装引导器仅支持openKylin操作系统,具体为", this.localConfigObject.supportList);
|
||||
await dialog.showMessageBox(this.DeployWindow,
|
||||
{
|
||||
type: "error",
|
||||
|
@ -502,15 +525,15 @@ export class DeployMainService implements IDeployMainService {
|
|||
if (installUtils.compareVersions(this.updateConfigObject.g_index_Object.ver, this.localConfigObject.g_index_Object.ver) > 0) {
|
||||
//显示询问用户是否更新配置文件
|
||||
//比较具体的配置文件是否一致,若是一致则还是选择本地配置,若是不同则
|
||||
let updateosinfo = this.updateConfigObject.osinfo;
|
||||
let localosinfo = this.localConfigObject.osinfo;
|
||||
if (this.updateConfigObject.g_index_Object["config-file"][updateosinfo][0]['sign-md5'] !== this.localConfigObject.g_index_Object["config-file"][localosinfo][0]['sign-md5'])
|
||||
selectPageShow = 4;
|
||||
else {
|
||||
this.logger.info("联网数据与本地配置文件数据版本一致");
|
||||
selectPageShow = 3;
|
||||
message = "联网数据与本地配置文件数据版本一致";
|
||||
}
|
||||
message = "配置文件有更新";
|
||||
// if (this.updateConfigObject.g_index_Object["config-file"][updateosinfo][0]['sign-md5'] !== this.localConfigObject.g_index_Object["config-file"][localosinfo][0]['sign-md5'])
|
||||
// selectPageShow = 4;
|
||||
// else {
|
||||
// this.logger.info("联网数据与本地配置文件数据版本一致");
|
||||
// selectPageShow = 3;
|
||||
// message = "联网数据与本地配置文件数据版本一致";
|
||||
// }
|
||||
} else {
|
||||
selectPageShow = 3;
|
||||
this.logger.info("联网数据与本地配置文件数据版本一致");
|
||||
|
@ -524,6 +547,7 @@ export class DeployMainService implements IDeployMainService {
|
|||
this.selectObject.extAddressPath = this.localConfigDir + "/" + this.localConfigObject.g_index_Object['ext-file']['file_name'];
|
||||
Data = {
|
||||
osinfo: this.localConfigObject.osinfo,
|
||||
osrelease: this.localConfigObject.osrelease,
|
||||
selectPageShow: selectPageShow,
|
||||
type: "configVersify"
|
||||
}
|
||||
|
@ -548,9 +572,9 @@ export class DeployMainService implements IDeployMainService {
|
|||
};
|
||||
|
||||
handleInitConfigSelect = async (event: IpcMainInvokeEvent, msg: any) => {
|
||||
let osinfo = "";
|
||||
let osrelease = "";
|
||||
if (msg.select === "local") {
|
||||
osinfo = this.localConfigObject.osinfo;
|
||||
osrelease = this.localConfigObject.osrelease;
|
||||
this.selectObject.dirPath = this.localConfigDir;
|
||||
this.selectObject.updateFlag = false;
|
||||
this.selectObject.depInfoJsonPath = this.localConfigDir + "/" + this.localConfigObject.depConfigInfo['file_name'];
|
||||
|
@ -558,7 +582,7 @@ export class DeployMainService implements IDeployMainService {
|
|||
} else if (msg.select === "update") {
|
||||
this.selectObject.dirPath = this.updateConfigDir;
|
||||
this.selectObject.updateFlag = true;
|
||||
osinfo = this.updateConfigObject.osinfo;
|
||||
osrelease = this.updateConfigObject.osrelease;
|
||||
this.selectObject.depInfoJsonPath = this.updateConfigDir + "/" + this.updateConfigObject.depConfigInfo['file_name'];
|
||||
this.selectObject.extAddressPath = this.updateConfigDir + "/" + this.updateConfigObject.g_index_Object['ext-file']['file_name']; //error
|
||||
|
||||
|
@ -566,12 +590,12 @@ export class DeployMainService implements IDeployMainService {
|
|||
const { osFile, data } = this.readOSInfo();
|
||||
const osObject = {
|
||||
type: "osinfo",
|
||||
osinfo: osinfo,
|
||||
osrelease: osrelease,
|
||||
osFile: osFile,
|
||||
osData: data
|
||||
}
|
||||
this.logger.info(`选择的配置文件名称:${this.selectObject.depInfoJsonPath}`);
|
||||
this.logger.info(`识别操作系统信息:${osinfo}`);
|
||||
this.logger.info(`识别操作系统信息:${osrelease}`);
|
||||
|
||||
if (this.DeployWindow) {
|
||||
// this.DeployWindow.webContents.send('kylinide.installWizard.init', osObject);
|
||||
|
@ -1613,10 +1637,14 @@ export class DeployMainService implements IDeployMainService {
|
|||
if (!this.versify(`${match_ext_filePath}`, match_ext_file_sign)) {
|
||||
flag++;
|
||||
}
|
||||
//执行脚本,获取操作系统标识信息
|
||||
const functionName = 'getoscontent';
|
||||
let [osinfo, osrelease, supportList] = await this.loadAndInvokeFunction(match_script_filePath, functionName);
|
||||
//执行脚本,获取操作系统信息
|
||||
const functionName = 'getosinfo';
|
||||
const osinfo = await this.loadAndInvokeFunction(match_script_filePath, functionName);
|
||||
this.logger.info("通过脚本" + match_script_filePath + "获取操作系统信息" + osinfo);
|
||||
// const = await this.loadAndInvokeFunction(match_script_filePath, "showosinfo");
|
||||
//执行脚本,获取操作系统信息
|
||||
|
||||
this.logger.info("通过脚本" + match_script_filePath + "获取操作系统信息" + osrelease);
|
||||
let localConfigMatch = 0;
|
||||
// 检测文件是否有osinfo想匹配的
|
||||
if (g_index_localDataObject["config-file"].hasOwnProperty(`${osinfo}`)) {
|
||||
|
@ -1660,6 +1688,8 @@ export class DeployMainService implements IDeployMainService {
|
|||
res: res,
|
||||
g_index_Object: g_index_localDataObject,
|
||||
osinfo: osinfo,
|
||||
osrelease: osrelease,
|
||||
supportList: supportList,
|
||||
localConfigMatch: localConfigMatch,
|
||||
depConfigInfo: osinfo !== "undefined" ? g_index_localDataObject['config-file'][osinfo][0] : {}
|
||||
}
|
||||
|
@ -1671,7 +1701,9 @@ export class DeployMainService implements IDeployMainService {
|
|||
g_index_Object: "",
|
||||
osinfo: "",
|
||||
localConfigMatch: -1,
|
||||
depConfigInfo: {}
|
||||
depConfigInfo: {},
|
||||
osrelease: "",
|
||||
supportList: []
|
||||
}
|
||||
return configData;
|
||||
}
|
||||
|
@ -1722,9 +1754,9 @@ export class DeployMainService implements IDeployMainService {
|
|||
flag++;
|
||||
}
|
||||
//执行脚本,获取操作系统信息
|
||||
const functionName = 'getosinfo';
|
||||
let osinfo = await this.loadAndInvokeFunction(match_script_filePath, functionName);
|
||||
this.logger.info("通过脚本" + match_script_filePath + "获取操作系统信息" + osinfo);
|
||||
const functionName = 'getoscontent';
|
||||
let [osinfo, osrelease, supportList] = await this.loadAndInvokeFunction(match_script_filePath, functionName);
|
||||
this.logger.info("通过脚本" + match_script_filePath + "获取操作系统信息" + osrelease);
|
||||
|
||||
let ConfigMatch = 0;
|
||||
// 检测文件是否有osinfo想匹配的
|
||||
|
@ -1782,6 +1814,8 @@ export class DeployMainService implements IDeployMainService {
|
|||
res: res,
|
||||
g_index_Object: g_index_Object,
|
||||
osinfo: osinfo,
|
||||
osrelease: osrelease,
|
||||
supportList: supportList,
|
||||
ConfigMatch: ConfigMatch,
|
||||
base_url: g_index_Object['base-url'],
|
||||
depConfigInfo: osinfo !== "undefined" ? g_index_Object['config-file'][osinfo][0] : {}
|
||||
|
@ -1795,7 +1829,9 @@ export class DeployMainService implements IDeployMainService {
|
|||
osinfo: "",
|
||||
ConfigMatch: -1,
|
||||
base_url: "",
|
||||
depConfigInfo: {}
|
||||
depConfigInfo: {},
|
||||
osrelease: "",
|
||||
supportList: []
|
||||
}
|
||||
return configData;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue