From e39d3b01891df3038834b9dce9cc42a24eddce87 Mon Sep 17 00:00:00 2001 From: dinglili Date: Fri, 2 Aug 2024 17:29:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E9=85=8D=E7=BD=AEupdate2-2303?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kylin-ide/1.2.1/g_index.json | 10 +- .../kylin-ide/1.2.1/go_config-0.0.1.js | 508 ------------------ ...t-0.0.2.js => os_classify_script-0.0.3.js} | 6 +- 3 files changed, 6 insertions(+), 518 deletions(-) delete mode 100644 inst-configs-repo/kylin-ide/1.2.1/go_config-0.0.1.js rename inst-configs-repo/kylin-ide/1.2.1/{os_classify_script-0.0.2.js => os_classify_script-0.0.3.js} (97%) diff --git a/inst-configs-repo/kylin-ide/1.2.1/g_index.json b/inst-configs-repo/kylin-ide/1.2.1/g_index.json index 53ad4ce..fe3980a 100644 --- a/inst-configs-repo/kylin-ide/1.2.1/g_index.json +++ b/inst-configs-repo/kylin-ide/1.2.1/g_index.json @@ -1,5 +1,5 @@ { - "ver": "0.0.5", + "ver": "0.0.6", "base-url":"https://gitee.com/openkylin/extensions-repo/raw/master/inst-configs-repo/kylin-ide/1.2.1", "ext-file": { "file_url": "base-url:/ext_link_address-0.0.2.json", @@ -9,10 +9,10 @@ }, "match-script": { - "file_url": "base-url:/os_classify_script-0.0.2.js", - "file_name": "os_classify_script-0.0.2.js", - "ver": "0.0.2", - "sign-md5": "69d35d97daf4ccee66eee90fa011645cd653a08d9f33411c25477bce66545ad539bc532a4425aca3cd03ed4afe6787763cc5b3f75569d14066413f9b5d69d5cf94c8dd49c45085b7491a3537794944600b1e0c7631a645a81f3e6f32b1e48e3d41f22f17a8acb6e9f4e4f4de861c4a07dd2ce9ffba36c5471b2a660a6eb2536c" + "file_url": "base-url:/os_classify_script-0.0.3.js", + "file_name": "os_classify_script-0.0.3.js", + "ver": "0.0.3", + "sign-md5": "5fd7d27cd9a777032912de5bade90700656d69bc9a7ea91a14a3bfd11879b8cd2f14480a29a0731dc32988d715935616b1ed1f175c5a775b6de6982a3825e4b740117954a5523789112f888d9762e81a1d049c8310173e5fe27df842102ff34943c7284f39f05616f4e02d05ba3acb5e2069f6a5562a4a59cd1be8ef3e0d4459" }, "config-file": { "x86_kylin_desktop_v10_2203": [ diff --git a/inst-configs-repo/kylin-ide/1.2.1/go_config-0.0.1.js b/inst-configs-repo/kylin-ide/1.2.1/go_config-0.0.1.js deleted file mode 100644 index dab8ec5..0000000 --- a/inst-configs-repo/kylin-ide/1.2.1/go_config-0.0.1.js +++ /dev/null @@ -1,508 +0,0 @@ -const { exec, spawnSync, spawn, execSync } = require('child_process'); -const os = require('os'); -const fs = require('fs'); -//go工具安装 -function GoToolsInstall(archName, goVersion, goPath, systemtype) { - return new Promise(async (resolve, reject) => { - let installToolsMessage = ''; - let codeProcess = 0 - if (archName.indexOf('longarch64') === -1) { - installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go版本为" + goVersion + "的工具:" + '\n'; - switch (goVersion) { - case '1.13': - console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") - try { - await gopls095Install(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await dlv160Install(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await goOutLineInstall(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - - resolve([installToolsMessage, codeProcess]) - - } catch (error) { - console.log("Go工具安裝失败!") - } - - return - case '1.14': - console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") - try { - - await gopls095Install(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await dlv161Install(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await goOutLineInstall(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - resolve([installToolsMessage, codeProcess]) - } catch (error) { - console.log("Go工具安裝失败:", error) - } - return - case '1.15': - console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") - try { - await gopls095Install(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await dlv161Install(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await goOutLineInstall(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - resolve([installToolsMessage, codeProcess]) - } catch (error) { - console.log("Go工具安裝失败:", error) - } - return - default: - console.log("正在", archName, "架构,", systemtype, "系统类型上安装go工具:") - installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go工具:" + '\n'; - try { - await goplsInstall(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await dlvInstall(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await goOutLineInstall(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - resolve([installToolsMessage, codeProcess]) - } catch (error) { - console.log("Go工具安裝失败:", error) - } - } - } else { - installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go版本为" + goVersion + "的工具:" + '\n'; - switch (goVersion) { - case '1.15': - console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") - try { - await gopls095Install(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await goOutLineInstall(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - resolve([installToolsMessage, codeProcess]) - } catch (error) { - console.log("Go工具安裝失败:", error) - } - - return - case '1.14': - console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") - try { - await gopls095Install(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await goOutLineInstall(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - resolve([installToolsMessage, codeProcess]) - } catch (error) { - console.log("Go工具安裝失败:", error) - } - return - case '1.13': - console.log("正在", archName, "架构,", systemtype, "系统类型上安装go版本为", goVersion, "的工具:") - - try { - await gopls095Install(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await goOutLineInstall(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - resolve([installToolsMessage, codeProcess]) - } catch (error) { - console.log("Go工具安裝失败:", error) - } - - return - default: - console.log("正在", archName, "架构,", systemtype, "系统类型上安装go工具:") - installToolsMessage = "正在" + archName + "架构," + systemtype + "系统类型上安装go工具" + '\n'; - try { - await goplsInstall(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - await goOutLineInstall(goPath) - .then(([results, code]) => { - installToolsMessage += results + '\n' - codeProcess += code - }) - .catch((error) => { - console.error(error); - }); - resolve([installToolsMessage, codeProcess]) - } catch (error) { - console.log("Go工具安裝失败:", error) - } - - } - - } - }) - - -} -//判断go路径是否存在 -function executableFileExists(filePath) { - let exists = true; - try { - exists = fs.statSync(filePath).isFile(); - if (exists) { - fs.accessSync(filePath, fs.constants.F_OK | fs.constants.X_OK); - } - } catch (e) { - exists = false; - } - return exists; -} -//下载gopls@0.9.5 -function gopls095Install(goPath) { - return new Promise((resolve, reject) => { - const ls = spawn(goPath, ["get", "-v", "golang.org/x/tools/gopls@v0.9.5"]); - ls.stderr.on('data', (data) => { console.error(`${data}`); }); - ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); - ls.on('close', (code) => { - console.log(`子进程退出码:${code}`); - if (code === 0) { - console.log("gopls@v0.9.5安装成功"); - resolve(["gopls@v0.9.5安装成功", code]); - - } else { - console.log("gopls@v0.9.5安装失败"); - resolve(["gopls@v0.9.5安装失败", code]); - } - }); - }) -} -//下载gopls -function goplsInstall(goPath) { - return new Promise((resolve, reject) => { - const ls = spawn(goPath, ["get", "-v", "golang.org/x/tools/gopls"]); - - ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); - - ls.stderr.on('data', (data) => { console.error(`${data}`); }); - - ls.on('close', (code) => { - console.log(`子进程退出码:${code}`); - if (code === 0) { - console.log("gopls安装成功"); - resolve(["gopls安装成功", code]); - } else { - console.log("gopls安装失败"); - resolve(["gopls安装失败", code]); - } - }); - }) - -} -//下载dlv@1.6.0 -function dlv160Install(goPath) { - return new Promise((resolve, reject) => { - const ls = spawn(goPath, ["get", "-v", "github.com/go-delve/delve/cmd/dlv@v1.6.0"]); - - ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); - - ls.stderr.on('data', (data) => { console.error(`${data}`); }); - - ls.on('close', (code) => { - console.log(`子进程退出码:${code}`); - if (code === 0) { - console.log("dlv@v1.6.0安装成功"); - resolve(["dlv@v1.6.0安装成功", code]); - } else { - console.log("dlv@v1.6.0安装失败"); - resolve(["dlv@v1.6.0安装失败", code]); - } - }); - }) - -} -//下载dlv@1.6.1 -function dlv161Install(goPath) { - return new Promise((resolve, reject) => { - const ls = spawn(goPath, ["get", "-v", "github.com/go-delve/delve/cmd/dlv@v1.6.1"]); - - ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); - - ls.stderr.on('data', (data) => { console.error(`${data}`); }); - - ls.on('close', (code) => { - console.log(`子进程退出码:${code}`); - if (code === 0) { - console.log("dlv@v1.6.1安装成功"); - resolve(["dlv@v1.6.1安装成功", code]) - } else { - console.log("dlv@v1.6.1安装失败"); - resolve(["dlv@v1.6.1安装失败", code]) - } - }); - }) - -} -//下载dlv -function dlvInstall(goPath) { - return new Promise((resolve, reject) => { - const ls = spawn(goPath, ["get", "-v", "github.com/go-delve/delve/cmd/dlv"]); - - ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); - - ls.stderr.on('data', (data) => { console.error(`${data}`); }); - - ls.on('close', (code) => { - console.log(`子进程退出码:${code}`); - if (code === 0) { - console.log("dlv安装成功"); - resolve(["dlv安装成功", code]) - } else { - console.log("dlv安装失败"); - resolve(["dlv安装失败", code]) - } - }); - }) -} - -//下载go-outline -function goOutLineInstall(goPath) { - return new Promise((resolve, reject) => { - const ls = spawn(goPath, ["get", "-v", "github.com/ramya-rao-a/go-outline"]); - - ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); - - ls.stderr.on('data', (data) => { console.error(`${data}`); }); - - ls.on('close', (code) => { - console.log(`子进程退出码:${code}`); - if (code === 0) { - console.log("go-outline安装成功"); - resolve(["go-outline安装成功", code]) - } else { - console.log("go-outline安装失败"); - resolve(["go-outline安装失败", code]) - } - }); - }) -} -//获取go路径以及版本号 -function getGoPath() { - const p = ""; - const defaultPathsForGo = - process.platform === 'win32' - ? ['C:\\Program Files\\Go\\bin\\go.exe', 'C:\\Program Files (x86)\\Go\\bin\\go.exe'] - : ['/usr/bin/go', '/bin/go', '/usr/local/go/bin/go', '/usr/local/bin/go', '/usr/lib/go-1.15/bin/go', '/usr/lib/go-1.14/bin/go', '/usr/lib/go-1.13/bin/go']; - for (const p of defaultPathsForGo) { - if (executableFileExists(p)) { - - return p; - } - - } - return p; -} -//设置go代理 -function setting(goPath) { - process.env.GO111MODULE = "on"; - process.env.GOPROXY = "https://goproxy.cn,direct"; - exec(`${goPath} env -w GO111MODULE=on && ${goPath} env -w GOPROXY=https://goproxy.cn,direct`, (error, stdout, stderr) => { - - if (error) { - console.error(`exec error: ${error}`); - return; - } - // console.log(`stdout: ${stdout}`); - console.log("Go代理设置成功!") - // console.log(`stderr: ${stderr}`); - }) - -} -//检查系统类型 -function checkSystemType() { - let cmdResult = spawnSync('ls', ['/usr/bin/dpkg']); - if (cmdResult.stdout !== null) { - let libcResult = spawnSync('dpkg-query', ['-W', 'libc6']); - - if (libcResult.stdout !== null) { - if (libcResult.stdout.toString() !== '') { - return 'deb'; - } - - } - } - cmdResult = spawnSync('ls', ['/usr/bin/rpm']); - if (cmdResult.stdout !== null) { - let libcResult = spawnSync('rpm', ['-qa', 'glibc']); - if (libcResult.stdout !== null) { - if (libcResult.stdout.toString() !== '') { - return 'rpm'; - } - - } - } - return 'unknown'; - -} - - -async function main() { - return new Promise((resolve, reject) => { - let goVersion = ""; - let goPath = ""; - const archName = os.arch(); - goPath = getGoPath(); - if (goPath === '') { - resolve("go路径找不到"); - return; - } - if (goPath.indexOf('go-1.15') !== -1) { - goVersion = "1.15"; - } else if (goPath.indexOf('go-1.14') !== -1) { - goVersion = "1.14"; - } else if (goPath.indexOf('go-1.13') !== -1) { - goVersion = "1.13"; - } else { - - let cmdResult = spawnSync('go', ['version']); - if (cmdResult && cmdResult.stdout !== null && cmdResult.stdout.toString().indexOf("1.13") !== -1) { - goVersion = '1.13'; - } - } - const systemtype = checkSystemType(); - - - let p = new Promise((resolve, reject) => { - setting(goPath) - setTimeout(() => { - resolve(); - }, 1000); - - // reject("dddd"); - }) - p.then(async (value) => { - if (goPath !== "") { - GoToolsInstall(archName, goVersion, goPath, systemtype) - .then(([results, code]) => { - resolve([results, code]) - }) - } else { - console.log("找不到go路径") - } - - - }) - }) - -} -// main(); -module.exports = { - main -} diff --git a/inst-configs-repo/kylin-ide/1.2.1/os_classify_script-0.0.2.js b/inst-configs-repo/kylin-ide/1.2.1/os_classify_script-0.0.3.js similarity index 97% rename from inst-configs-repo/kylin-ide/1.2.1/os_classify_script-0.0.2.js rename to inst-configs-repo/kylin-ide/1.2.1/os_classify_script-0.0.3.js index 678c747..39146e4 100644 --- a/inst-configs-repo/kylin-ide/1.2.1/os_classify_script-0.0.2.js +++ b/inst-configs-repo/kylin-ide/1.2.1/os_classify_script-0.0.3.js @@ -103,9 +103,7 @@ function getFileData() { os_version_id = version_id; } os_type = dist_id.includes('desktop') ? "desktop" : "server"; - if (milestone.indexOf('release')!==-1) { - os_release = milestone.slice(milestone.indexOf('release') + 8); - }else{ + if(kylin_release_id){ os_release=kylin_release_id; } @@ -209,8 +207,6 @@ function getoscontent(){ } getFileData(); -console.log(getoscontent()); - module.exports = { getosinfo , showosinfo,