From f96e00fa45c6c03aa484911b43757948b67313af Mon Sep 17 00:00:00 2001 From: dinglili Date: Tue, 30 Jan 2024 10:57:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0kylin-code=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E5=99=A8=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/desktop_os_common-0.0.1.json | 246 +++++++++ .../config/ext_link_address-0.0.1.json | 319 +++++++++++ .../kylin-code/config/g_index.json | 32 ++ .../kylin-code/config/go_config-0.0.1.js | 508 ++++++++++++++++++ .../config/os_classify_script-0.0.1.js | 141 +++++ .../kylin-code/config/python3_config-0.0.1.sh | 3 + 6 files changed, 1249 insertions(+) create mode 100644 inst-configs-repo/kylin-code/config/desktop_os_common-0.0.1.json create mode 100644 inst-configs-repo/kylin-code/config/ext_link_address-0.0.1.json create mode 100644 inst-configs-repo/kylin-code/config/g_index.json create mode 100644 inst-configs-repo/kylin-code/config/go_config-0.0.1.js create mode 100644 inst-configs-repo/kylin-code/config/os_classify_script-0.0.1.js create mode 100644 inst-configs-repo/kylin-code/config/python3_config-0.0.1.sh diff --git a/inst-configs-repo/kylin-code/config/desktop_os_common-0.0.1.json b/inst-configs-repo/kylin-code/config/desktop_os_common-0.0.1.json new file mode 100644 index 0000000..d3b05f6 --- /dev/null +++ b/inst-configs-repo/kylin-code/config/desktop_os_common-0.0.1.json @@ -0,0 +1,246 @@ +{ + "version":"0.0.1", + "kylin-ide-lowest-ver":"0.3.0", + "first_class_list":{ + "description":{ + "en":"", + "zh_cn":"勾选分类后,会安装该选项的基本插件、系统软件依赖。可以从插件市场或openKylin extensions-repo仓库获取更多插件。" + }, + "Remote_key":{ + "en":"Remote development", + "zh_cn":"远程开发" + }, + "C_key":{ + "en":"C/C++ development", + "zh_cn":"C/C++开发" + }, + "Python3_key":{ + "en":"Python3 development", + "zh_cn":"Python3开发" + }, + "Go_key":{ + "en":"Go development", + "zh_cn":"Go开发" + }, + "JavaScript_key":{ + "en":"Built-in JavaScript development", + "zh_cn":"内置JavaScript开发", + "show_type":"picked_gray" + } + }, + "second_class":{ + "Remote_key": { + "discription":{ + "en":"Remote development", + "zh_cn":"远程开发" + }, + "ext-list": [ + "KylinIdeTeam.extension-dependency", + "xhafei.remote-dev" + ], + "pkg-list":{ + }, + "script-list":[ + ] + }, + "C_key": { + "discription":{ + "en":"Basic function of C/C++ development: linting, intellisense, compile, debug. You may install other extensions to get more functions.", + "zh_cn":"C/C++开发需要的基本功能:语法检查、跳转、补全、编译、调试等。可以安装其他插件获得更多功能。" + }, + "ext-list": [ + "KylinIdeTeam.extension-dependency", + "KylinIdeTeam.gitlens", + "KylinIdeTeam.project-manager", + "KylinIdeTeam.vscode-clangd", + "KylinIdeTeam.debug", + "KylinIdeTeam.cmake-intellisence" + ], + "pkg-list":{ + "deb":{ + "git":{}, + "ssh-askpass":{}, + "clangd":{}, + "libclang-common-10-dev":{}, + "build-essential":{}, + "cmake":{}, + "gdb":{}, + "debhelper":{} + } + }, + "script-list":[ + ] + }, + "Python3_key":{ + "discription":{ + "en":"Python3 development", + "zh_cn":"Python3开发" + }, + "ext-list": [ + "KylinIdeTeam.extension-dependency", + "KylinIdeTeam.gitlens", + "KylinIdeTeam.python" + ], + "pkg-list":{ + "deb":{ + "git":{}, + "ssh-askpass":{}, + "python3":{}, + "python3-autopep8":{}, + "python3-pip":{} + } + }, + "script-list":[ + { + "order":1, + "postin":"python3-pip" , + "file_url":"base-url:/python3_config-0.0.1.sh", + "file_name": "python3_config-0.0.1.sh", + "ver": "0.0.1", + "sign-md5": "5abef8fab04ca04d2b74531c1e563ceac297e3bdced8df4a519dad90386f25682ec985b008ab73b25254add9ae92f840a1d86a5c4829389d328aa555ef30e792fee4a8beaf3da2ddba2afe19ddfa03898fef102299ef5a8fe2001af394a7e2ecfd0adc63fe4231bc95337909856b438ed73acba41f217c8f0f2ae7640bb2cc78" + } + ] + }, + "Go_key":{ + "discription":{ + "en":"Go development", + "zh_cn":"Go开发" + }, + "ext-list": [ + "KylinIdeTeam.extension-dependency", + "KylinIdeTeam.gitlens", + "KylinIdeTeam.go" + ], + "pkg-list":{ + "deb":{ + "git":{}, + "ssh-askpass":{}, + "golang-1.14":{} + } + }, + "script-list":[ + { + "order":1, + "postin":"golang-1.14", + "file_url":"base-url:/go_config-0.0.1.js", + "file_name": "go_config-0.0.1.js", + "ver": "0.0.1", + "sign-md5": "cd79e95d69868f87caca7197e68597e29a4ac9c6fce6134ba174e2f8331e372e6e7598d5e769b9dd06f8f99a82dfa5cb8602e7b17cd63e330273a7f1bb0befe25d3101ddddc7b11546cb9dfd7bf9266d5ffc0e2fc460e3bb074aba311f0ec6c930d85f61a7f4db0b473400863204b13a6f0d08749193fbaf190fafa72d340054" + } + ] + }, + "JavaScript_key":{ + "discription":{ + "en":"Built-in support JavaScript development(Please install NodeJS by yourself if needed)", + "zh_cn":"内置支持JavaScript开发(如需NodeJS,请自行安装)" + }, + "ext-list": [ + + ], + "pkg-list":{ + + }, + "script-list":[ + + ] + } + }, + "ext_detail":{ + "KylinIdeTeam.extension-dependency":{ + "ext_id": "KylinIdeTeam.extension-dependency", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.project-manager":{ + "ext_id": "KylinIdeTeam.project-manager", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.vscode-gradle":{ + "ext_id": "KylinIdeTeam.vscode-gradle", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.vscode-java-dependency":{ + "ext_id": "KylinIdeTeam.vscode-java-dependency", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.vscode-java-pack": { + "ext_id": "KylinIdeTeam.vscode-java-pack", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.vscode-java-test": { + "ext_id": "KylinIdeTeam.vscode-java-test", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.vscode-maven": { + "ext_id": "KylinIdeTeam.vscode-maven", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.gitlens": { + "ext_id": "KylinIdeTeam.gitlens", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.cmake-intellisence": { + "ext_id": "KylinIdeTeam.cmake-intellisence", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.go": { + "ext_id": "KylinIdeTeam.go", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.java": { + "ext_id": "KylinIdeTeam.java", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.python": { + "ext_id": "KylinIdeTeam.python", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.vscode-clangd": { + "ext_id": "KylinIdeTeam.vscode-clangd", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.debug": { + "ext_id": "KylinIdeTeam.debug", + "ext_version": { + "latest":true + } + }, + "KylinIdeTeam.vscode-java-debug": { + "ext_id": "KylinIdeTeam.vscode-java-debug", + "ext_version": { + "latest":true + } + }, + "xhafei.remote-dev": { + "ext_id": "xhafei.remote-dev", + "ext_version": { + "latest":true + } + } + } +} diff --git a/inst-configs-repo/kylin-code/config/ext_link_address-0.0.1.json b/inst-configs-repo/kylin-code/config/ext_link_address-0.0.1.json new file mode 100644 index 0000000..9497028 --- /dev/null +++ b/inst-configs-repo/kylin-code/config/ext_link_address-0.0.1.json @@ -0,0 +1,319 @@ +{ + "version": "0.0.1", + "KylinIdeTeam.extension-dependency": { + "ext_id": "KylinIdeTeam.extension-dependency", + "ext_name": "extension dependency", + "ext_descrip": { + "en": "extension dependency", + "zh_cn": "插件依赖管理器" + }, + + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-extension-dependency" + } + } + }, + "KylinIdeTeam.offline-extensions-manager": { + "ext_id": "KylinIdeTeam.offline-extensions-manager", + "ext_name":"offline extensions manager", + "ext_descrip": { + "en": "offline extensions manager", + "zh_cn": "离线插件管理器" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-offline-extensions-manager" + } + } + }, + "KylinIdeTeam.project-manager": { + "ext_id": "KylinIdeTeam.project-manager", + "ext_name":"Kylin Project Manager", + "ext_descrip": { + "en": "Kylin Project Manager", + "zh_cn": "麒麟项目管理器" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-project-manager" + } + } + }, + "KylinIdeTeam.vscode-gradle": { + "ext_id": "KylinIdeTeam.vscode-gradle", + "ext_name":"Java Gradle (Support openjdk11 runtime)", + "ext_descrip": { + "en": "Java Gradle (Support openjdk11 runtime)", + "zh_cn": "Java Gradle(支持openjdk11运行时)" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-vscode-gradle" + } + } + }, + "KylinIdeTeam.vscode-java-dependency": { + "ext_id": "KylinIdeTeam.vscode-java-dependency", + "ext_name":"Java Dependency (Support openjdk11 runtime)", + "ext_descrip": { + "en": "Java Dependency (Support openjdk11 runtime)", + "zh_cn": "Java依赖(支持openjdk11运行时) " + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-vscode-java-dependency" + } + } + }, + "KylinIdeTeam.vscode-java-pack": { + "ext_id": "KylinIdeTeam.vscode-java-pack", + "ext_name":"Java Pack (Support openjdk11 runtime)", + "ext_descrip": { + "en": "Java Pack (Support openjdk11 runtime)", + "zh_cn": "Java Pack(支持openjdk11运行时) " + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-vscode-java-pack" + } + } + }, + "KylinIdeTeam.vscode-java-test": { + "ext_id": "KylinIdeTeam.vscode-java-test", + "ext_name":"Java Test (Support openjdk11 runtime)", + "ext_descrip": { + "en": "Java Test (Support openjdk11 runtime)", + "zh_cn": "Java Test(支持openjdk11运行时) " + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-vscode-java-test" + } + } + }, + "KylinIdeTeam.vscode-maven": { + "ext_id": "KylinIdeTeam.vscode-maven", + "ext_name":"Java Maven (Support openjdk11 runtime)", + "ext_descrip": { + "en": "Java Maven (Support openjdk11 runtime)", + "zh_cn": "Java Maven(支持openjdk11运行时) " + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-vscode-maven" + } + } + }, + "KylinIdeTeam.gitlens": { + "ext_id": "KylinIdeTeam.gitlens", + "ext_name": "gitlens", + "ext_descrip": { + "en": "Gitlens lower version for friendly licence", + "zh_cn": "Gitlens免费版本" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-gitlens" + } + } + }, + "KylinIdeTeam.cmake-intellisence": { + "ext_id": "KylinIdeTeam.cmake-intellisence", + "ext_name": "CMake IntelliSence", + "ext_descrip": { + "en": "CMake IntelliSence", + "zh_cn": "CMake编辑支持" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "cmake-intellisence" + } + } + }, + "KylinIdeTeam.go": { + "ext_id": "KylinIdeTeam.go", + "ext_name": "Go(for KylinOS)", + "ext_descrip": { + "en": "Go(for KylinOS)", + "zh_cn": "Go编辑调试支持(适配麒麟操作系统)" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-go" + } + } + }, + "KylinIdeTeam.java": { + "ext_id": "KylinIdeTeam.java", + "ext_name": "Java (Support openjdk11 runtime) ", + "ext_descrip": { + "en": "Java (Support openjdk11 runtime) ", + "zh_cn": "Java编辑支持 (支持openjdk11运行时)" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-java" + } + } + }, + "KylinIdeTeam.python": { + "ext_id": "KylinIdeTeam.python", + "ext_name": "Python(with jedi language server)", + "ext_descrip": { + "en": "Python(with jedi language server) ", + "zh_cn": "Python编辑调试支持(使用jedi语言服务端)" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-python" + } + } + }, + "KylinIdeTeam.vscode-clangd": { + "ext_id": "KylinIdeTeam.vscode-clangd", + "ext_name": "vscode-clangd", + "ext_descrip": { + "en": "C/C++ edit support, use clangd as language server", + "zh_cn": "C/C++编辑支持,使用clangd作为语言服务端" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-vscode-clangd" + } + } + }, + "KylinIdeTeam.debug": { + "ext_id": "KylinIdeTeam.debug", + "ext_name": "Native Debug(fix some bugs)", + "ext_descrip": { + "en": "C/C++ gdb debug support", + "zh_cn": "C/C++ gdb调试支持" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "native-debug" + } + } + }, + "KylinIdeTeam.historydebug": { + "ext_id": "KylinIdeTeam.historydebug", + "ext_name": "historyDebug", + "ext_descrip": { + "en": "history debug", + "zh_cn": "历史调试支持" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "historydebug" + } + } + }, + "KylinIdeTeam.js-debug": { + "ext_id": "KylinIdeTeam.js-debug", + "ext_name": "JavaScript Debugger(for KylinOS)", + "ext_descrip": { + "en": "JavaScript Debugger(for KylinOS)", + "zh_cn": "JavaScript调试支持(适配麒麟系统)" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-js-debug" + } + } + }, + "KylinIdeTeam.vscode-java-debug": { + "ext_id": "KylinIdeTeam.vscode-java-debug", + "ext_name": "Java Debug (Support openjdk11 runtime)", + "ext_descrip": { + "en": "Java Debug (Support openjdk11 runtime)", + "zh_cn": "Java调试支持(支持openjdk11运行时)" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "vscode-java-debug" + } + } + }, + "KylinIdeTeam.deadlock-detect": { + "ext_id": "KylinIdeTeam.deadlock-detect", + "ext_name": "deadlock-detect", + "ext_descrip": { + "en": "C/C++/java deadlock detect", + "zh_cn": "C/C++/java 程序死锁分析" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "deadlock-detect" + } + } + }, + "KylinIdeTeam.memleak-detect": { + "ext_id": "KylinIdeTeam.memleak-detect", + "ext_name": "memleak-detect", + "ext_descrip": { + "en": "C/C++ memory leak detect", + "zh_cn": "C/C++ 程序泄漏检测" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "openkylin", + "repo": "ide-memleak-detect" + } + } + }, + "xhafei.remote-dev": { + "ext_id": "xhafei.remote-dev", + "ext_name": "Kylin remote development", + "ext_descrip": { + "en": "remote development support", + "zh_cn": "远程开发支持" + }, + "ext_links": { + "gitee": { + "prefix": "https://gitee.com", + "org": "mcy-kylin", + "repo": "remote-dev" + } + } + } +} \ No newline at end of file diff --git a/inst-configs-repo/kylin-code/config/g_index.json b/inst-configs-repo/kylin-code/config/g_index.json new file mode 100644 index 0000000..34b3dbb --- /dev/null +++ b/inst-configs-repo/kylin-code/config/g_index.json @@ -0,0 +1,32 @@ +{ + "ver": "0.0.1", + "base-url":"https://gitee.com/openkylin/extensions-repo/raw/master/inst-configs-repo/kylin-code/config", + "ext-file": { + "file_url": "base-url:/ext_link_address-0.0.1.json", + "file_name": "ext_link_address-0.0.1.json", + "ver": "0.0.1", + "sign-md5": "a57db37948052f7d03f102c16be8867a17a3b2b171bf75add8dd3d4f2b0774198e858c58792c7517fd875109eb8fee5206011c7635c87437e3d645d9b18102cfae988e2d2fc4a387cb6bbf49241b9e8fd2189ebae46633fa4bddc68912b849c07ab278eaba2adaadd260b122c7998b56b6e3308fdfdad57289522c66e8534f4d" + }, + "match-script": + { + "file_url": "base-url:/os_classify_script-0.0.1.js", + "file_name": "os_classify_script-0.0.1.js", + "ver": "0.0.1", + "sign-md5": "96c5730cd2fd1ca3e271011d8af71ca51f3c1c8a783811c2e95bb1b0131aab9c57463cc468dafd344ee617baf67ca96c529590159e7f66459ebbd219bcee7e7b7271c6e8eeed27831a696ec0d0d6a49dadb91bd5116a203cd363583384f0fccd53b0cb8e29b2f6b6b275be6fbc72e8d05fdb98f4a230377eefb2843e9a0a4e11" + }, + "config-file": { + "x86_openkylin_desktop": [ + { + "discription": { + "en": "X86 openKylin Desktop yangtze", + "zh_cn": "X86 openKylin开源操作系统" + }, + "file_url": "base-url:/desktop_os_common-0.0.1.json", + "file_name": "desktop_os_common-0.0.1.json", + "ver": "0.0.1", + "kylin-ide-lowest-ver": "0.3.0", + "sign-md5":"015746b2030147d9502c465fca90a7a5ff387b66690793869e2b155ec844fc34f01e6131043ab496265a18a7068649ab9892bd9adb5f52d0ec26e5e545df3d2f265da072a120d5d1b236f600bc701d88e1bd594cc6c846d806a9f5b32993a6eddeff860f590bf31784b6878424e29d69aba32f302ff6df63628f88e5ea1abab5" + } + ] + } +} \ No newline at end of file diff --git a/inst-configs-repo/kylin-code/config/go_config-0.0.1.js b/inst-configs-repo/kylin-code/config/go_config-0.0.1.js new file mode 100644 index 0000000..dab8ec5 --- /dev/null +++ b/inst-configs-repo/kylin-code/config/go_config-0.0.1.js @@ -0,0 +1,508 @@ +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-code/config/os_classify_script-0.0.1.js b/inst-configs-repo/kylin-code/config/os_classify_script-0.0.1.js new file mode 100644 index 0000000..0299c41 --- /dev/null +++ b/inst-configs-repo/kylin-code/config/os_classify_script-0.0.1.js @@ -0,0 +1,141 @@ +const os = require('os'); +const fs = require('fs'); +var os_arch; //arch x86_64 +var os_org; //Kylin +var os_type; // Desktop Server +var os_release;// eg:2203 +var os_version_id; // V10 +var os_sp;//sp +var os_custom; //hwe +var pretty_name; +//检查系统架构 +function getArch() { + const arch = os.arch(); + let res = ''; + switch (arch) { + case 'x64': + case 'x86': + case "x86_64": res = 'x86'; break; + case 'arm': + case 'arm64': + case 'aarch64': res = 'arm'; break; + case 'loongarch': res = 'loongarch'; break; + default: res = "other"; + } + return res; +} + +function returnosinfo() { + if (os_arch == 'x86' && os_org == 'openkylin' && os_type == 'desktop') { + return "x86_openkylin_desktop"; + } + return "undefined" +} + +function getosinfo() { + const kyinfoPath = '/etc/.kyinfo'; + const osReleasePath = '/etc/os-release'; + //1、架构 + //2、是否是麒麟系统 + //3、是桌面系统还是服务器系统 + //4、是否是V10 + //5、是否带sp,是sp几 + //6、小版本号 + //7、定制版字符 + + var dist_id; + var os_info + os_arch = getArch(); + /*分类型进行处理 + 1.存在.kyinfo的系统 ,取值dist_id 中 架构之前的信息 + 2.不在.kyinfo的系统,但是存在os-release 的kylin系统 + 3.不是kylin的系统,但是存在os-release + 目前可以先做第一和第二种分类 + */ + let data; + let releasedata; + if (fs.existsSync(kyinfoPath) && fs.existsSync(osReleasePath)) { + os_org = "kylin"; + try { + let milestone; + let dist_id; + let tmpstr; + let version_id; + data = fs.readFileSync(kyinfoPath, 'utf8'); + releasedata = fs.readFileSync(osReleasePath, 'utf8'); + // 使用 split 方法将文件内容分割成行数组 + const lines = data.split('\n'); + // 遍历行数组 获取系统架构 + lines.forEach((line) => { + if (line.startsWith("milestone=")) { + milestone = line.slice(10).toLocaleLowerCase(); + } else if (line.startsWith("dist_id=")) { + dist_id = line.slice(8).toLocaleLowerCase(); + } + });//end lines + + const releasedatalines = releasedata.split('\n'); + releasedatalines.forEach((line) => { + if (line.startsWith("PRETTY_NAME=")) { + pretty_name = line.slice(12).toLocaleLowerCase().replace(/"/g, ''); + } else if (line.startsWith("VERSION_ID=")) { + version_id = line.slice(11).toLocaleLowerCase().replace(/"/g, ''); + } + }); + if (version_id) { + os_version_id = version_id; + } + os_type = dist_id.includes('desktop') ? "desktop" : "server"; + if (milestone.indexOf('release')) { + os_release = milestone.slice(milestone.indexOf('release') + 8); + } + + if (dist_id.includes('edu')) { + os_custom = 'edu'; + } else { + os_custom = 'gen'; + } + if (dist_id.includes('hwe')) { + os_custom += 'hwe'; + } + if (dist_id.includes('gfb')) { + l + os_custom += 'gfb' + } + } catch (err) { + os_info = ""; + } + }else if(fs.existsSync(osReleasePath)){ + try { + let milestone; + let dist_id; + let tmpstr; + let version_id; + releasedata = fs.readFileSync(osReleasePath, 'utf8'); + const releasedatalines = releasedata.split('\n'); + releasedatalines.forEach((line) => { + if (line.startsWith("PRETTY_NAME=")) { + pretty_name = line.slice(12).toLocaleLowerCase().replace(/"/g, ''); + } else if (line.startsWith("VERSION_ID=")) { + version_id = line.slice(11).toLocaleLowerCase().replace(/"/g, ''); + }else if (line.startsWith("ID=")) { + os_org = line.slice(3).toLocaleLowerCase().replace(/"/g, ''); + }else if (line.startsWith("VERSION_CODENAME=")) { + os_custom = line.slice(17).toLocaleLowerCase().replace(/"/g, ''); + } + }); + if (version_id) { + os_version_id = version_id; + } + if(pretty_name.includes('openkylin')) + os_type ="desktop"; + } catch (err) { + os_info = ""; + } + } + os_info = returnosinfo(); + return os_info; +} + +module.exports = { getosinfo } + diff --git a/inst-configs-repo/kylin-code/config/python3_config-0.0.1.sh b/inst-configs-repo/kylin-code/config/python3_config-0.0.1.sh new file mode 100644 index 0000000..bb463a0 --- /dev/null +++ b/inst-configs-repo/kylin-code/config/python3_config-0.0.1.sh @@ -0,0 +1,3 @@ +#!/bin/bash +echo "exec \"pip3 install pylint -i https://pypi.tuna.tsinghua.edu.cn/simple\"" +pip3 install pylint -i https://pypi.tuna.tsinghua.edu.cn/simple \ No newline at end of file