更新kylin-code开发环境部署配置文件
This commit is contained in:
parent
57394bd1d5
commit
8607bfff4e
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"version":"0.0.1",
|
||||
"kylin-ide-lowest-ver":"0.3.0",
|
||||
"version":"0.0.2",
|
||||
"kylin-ide-lowest-ver":"0.4.0",
|
||||
"first_class_list":{
|
||||
"description":{
|
||||
"en":"",
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"ver": "0.0.1",
|
||||
"ver": "0.0.2",
|
||||
"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",
|
||||
|
@ -9,23 +9,23 @@
|
|||
},
|
||||
"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"
|
||||
"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": "844d390832ab4e5fa9576e60f348a10cbd6474bff8a7af773d53a11243a0bb1e0f057ba5ba564516d25b8fe1e05b25a7540e2f037d26a574e2d6c2e1659f32425050cb3b7b39aea8ede59f165b3ed19a096100934970a1a1e6499dd32f82d20eb9a711dc449e6de3a45c10f75ec51c7c7b28e1851b50250499560b9d7eb2e826"
|
||||
},
|
||||
"config-file": {
|
||||
"x86_openkylin_desktop": [
|
||||
{
|
||||
"discription": {
|
||||
"en": "X86 openKylin Desktop yangtze",
|
||||
"en": "X86 openKylin Desktop",
|
||||
"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"
|
||||
"file_url": "base-url:/desktop_os_common-0.0.2.json",
|
||||
"file_name": "desktop_os_common-0.0.2.json",
|
||||
"ver": "0.0.2",
|
||||
"kylin-ide-lowest-ver": "0.4.0",
|
||||
"sign-md5":"0ea2ff6a15c6cb6ae894773771cbbc8eba5d4406a5a86c7a07ee6784fcd3b1c7cc71c874de8fdceec96265391a31bd2fe20bcbbb24cef8892410b6ce5e133c21454c73e7a3992b67569e7a6f228eebf2face8b4335b9c7e80e9a22eff42ff185dc89b06ce5b1124b752fbc1d6eff8a3e925f27d95bad0f82b00ec5c6b8fe068a"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
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 os_arch;
|
||||
var os_org;
|
||||
var os_type;
|
||||
var os_custom;
|
||||
var pretty_name;
|
||||
var milestone;
|
||||
var dist_id;
|
||||
var pretty_name;
|
||||
var os_info;
|
||||
const kyinfoPath = '/etc/.kyinfo';
|
||||
const osReleasePath = '/etc/os-release';
|
||||
//检查系统架构
|
||||
function getArch() {
|
||||
const arch = os.arch();
|
||||
|
@ -20,21 +23,19 @@ function getArch() {
|
|||
case 'arm64':
|
||||
case 'aarch64': res = 'arm'; break;
|
||||
case 'loongarch': res = 'loongarch'; break;
|
||||
default: res = "other";
|
||||
default: res = arch;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
function returnosinfo() {
|
||||
function getoskey() {
|
||||
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';
|
||||
function getFileData() {
|
||||
//1、架构
|
||||
//2、是否是麒麟系统
|
||||
//3、是桌面系统还是服务器系统
|
||||
|
@ -42,24 +43,17 @@ function getosinfo() {
|
|||
//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');
|
||||
|
@ -67,6 +61,7 @@ function getosinfo() {
|
|||
const lines = data.split('\n');
|
||||
// 遍历行数组 获取系统架构
|
||||
lines.forEach((line) => {
|
||||
line=line.replace(/ /g, "");
|
||||
if (line.startsWith("milestone=")) {
|
||||
milestone = line.slice(10).toLocaleLowerCase();
|
||||
} else if (line.startsWith("dist_id=")) {
|
||||
|
@ -99,43 +94,89 @@ function getosinfo() {
|
|||
os_custom += 'hwe';
|
||||
}
|
||||
if (dist_id.includes('gfb')) {
|
||||
l
|
||||
os_custom += 'gfb'
|
||||
}
|
||||
} catch (err) {
|
||||
os_info = "";
|
||||
console.log(err);
|
||||
}
|
||||
}else if(fs.existsSync(osReleasePath)){
|
||||
} 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, '');
|
||||
pretty_name=pretty_name.replace(/ /g, "_")
|
||||
} else if (line.startsWith("VERSION_ID=")) {
|
||||
version_id = line.slice(11).toLocaleLowerCase().replace(/"/g, '');
|
||||
}else if (line.startsWith("ID=")) {
|
||||
} else if (line.startsWith("ID=")) {
|
||||
os_org = line.slice(3).toLocaleLowerCase().replace(/"/g, '');
|
||||
}else if (line.startsWith("VERSION_CODENAME=")) {
|
||||
} else if (line.startsWith("VERSION_CODENAME=")) {
|
||||
os_custom = line.slice(17).toLocaleLowerCase().replace(/"/g, '');
|
||||
}else if(line.startsWith('NAME=')){
|
||||
os_org=line.slice(5).toLocaleLowerCase().replace(/"/g, '')
|
||||
}
|
||||
});
|
||||
if (version_id) {
|
||||
os_version_id = version_id;
|
||||
}
|
||||
if(pretty_name.includes('openkylin'))
|
||||
os_type ="desktop";
|
||||
if (pretty_name.includes('openkylin'))
|
||||
os_type = "desktop";
|
||||
|
||||
} catch (err) {
|
||||
os_info = "";
|
||||
}
|
||||
}
|
||||
os_info = returnosinfo();
|
||||
|
||||
}
|
||||
function getosinfo(){
|
||||
os_info = getoskey();
|
||||
return os_info;
|
||||
}
|
||||
|
||||
module.exports = { getosinfo }
|
||||
function showosinfo() {
|
||||
let osData = '';
|
||||
if (fs.existsSync(kyinfoPath)) {
|
||||
if (os_arch) { osData += os_arch; }
|
||||
if (os_org) { osData += "_" + os_org; }
|
||||
if (milestone) { osData += "_" + milestone; }
|
||||
osData = osData.replace(/^_+|_+$/g, '');
|
||||
osData = osData.replace("-release-", "-");
|
||||
osData = osData.replace(/-/g, "_");
|
||||
return osData;
|
||||
}
|
||||
else {
|
||||
//架构
|
||||
if (os_arch) {osData += os_arch;}
|
||||
//组织
|
||||
if (os_org) {osData += "_" + os_org;}
|
||||
//操作系统类型
|
||||
if (os_type) {osData += "_" + os_type;}
|
||||
if (pretty_name) {osData += "_" + pretty_name;}
|
||||
|
||||
if(os_custom){ osData += "_" + os_custom; }
|
||||
osData = osData.replace(/^_+|_+$/g, '');
|
||||
return osData;
|
||||
}
|
||||
}
|
||||
|
||||
function getsupportlist(){
|
||||
let strArry=["X86 openkylin操作系统"
|
||||
];
|
||||
return strArry;
|
||||
}
|
||||
|
||||
function getoscontent(){
|
||||
return [getosinfo(),showosinfo(),getsupportlist()]
|
||||
}
|
||||
getFileData();
|
||||
|
||||
module.exports = {
|
||||
getosinfo ,
|
||||
showosinfo,
|
||||
getsupportlist,
|
||||
getoscontent
|
||||
}
|
Loading…
Reference in New Issue