pinokiod 1.1.20 → 1.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/kernel/index.js CHANGED
@@ -230,7 +230,7 @@ class Kernel {
230
230
 
231
231
 
232
232
  let sysinfo = new Sysinfo()
233
- await sysinfo.init()
233
+ await sysinfo.init(this)
234
234
  let info = sysinfo.info
235
235
  await fs.promises.mkdir(this.path("logs"), { recursive: true }).catch((e) => { })
236
236
  await fs.promises.writeFile(this.path("logs/system.json"), JSON.stringify({
@@ -273,35 +273,6 @@ class Kernel {
273
273
  console.log("### ERROR", e)
274
274
  }
275
275
  }
276
- async sysinfo() {
277
- let g = await system.graphics()
278
- let gpus
279
- if (g && g.controllers && g.controllers.length > 0) {
280
- gpus = g.controllers.map((x) => { return x.vendor.toLowerCase() })
281
- } else {
282
- gpus = []
283
- }
284
-
285
- let is_nvidia = gpus.find(gpu => /nvidia/i.test(gpu))
286
- let is_amd = gpus.find(gpu => /(amd|advanced micro devices)/i.test(gpu))
287
- let is_apple = gpus.find(gpu => /apple/i.test(gpu))
288
-
289
- let gpu
290
- if (is_nvidia) {
291
- gpu = "nvidia"
292
- } else if (is_amd) {
293
- gpu = "amd"
294
- } else if (is_apple) {
295
- gpu = "apple"
296
- } else if (gpus.length > 0) {
297
- gpu = gpus[0]
298
- } else {
299
- gpu = "none"
300
- }
301
-
302
- return { gpus, gpu }
303
-
304
- }
305
276
  async exec(params, ondata) {
306
277
  // params.path = this.path()
307
278
  // if (this.client) {
package/kernel/sysinfo.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const system = require('systeminformation')
2
2
  class Sysinfo {
3
- async init() {
3
+ async init(kernel) {
4
+ this.kernel = kernel
4
5
  this.info = {}
5
6
  await this.static()
6
7
  await this.refresh()
@@ -11,6 +12,7 @@ class Sysinfo {
11
12
  await this.cpu()
12
13
  await this.os()
13
14
  await this.audio()
15
+ await this.env()
14
16
  // await this.disk()
15
17
  }
16
18
  async refresh() {
@@ -91,5 +93,37 @@ class Sysinfo {
91
93
  async bluetooth() {
92
94
  this.info.bluetooth = await system.bluetoothDevices()
93
95
  }
96
+ async env () {
97
+ let cmd
98
+ if (this.kernel.platform === "win32") {
99
+ cmd = "set"
100
+ } else {
101
+ cmd = "env"
102
+ }
103
+ let res = await this.kernel.bin.exec({ message: cmd, conda: "base" }, (stream) => {
104
+ })
105
+ let lines = res.response.split(/[\r\n]+/)
106
+ let vars = []
107
+ let started
108
+ for(let line of lines) {
109
+ if (started) {
110
+ // end BEFORE the next occurrence of <<PINOKIO SHELL>>
111
+ if (/<<PINOKIO SHELL>>/.test(line)) {
112
+ // do nothing => ignore this line
113
+ } else {
114
+ vars.push(line)
115
+ }
116
+ } else {
117
+ // start AFTER the first occurrence of <<PINOKIO SHELL>>
118
+ if (/<<PINOKIO SHELL>>/.test(line)) {
119
+ started = true
120
+ }
121
+ }
122
+ }
123
+
124
+
125
+ this.info.env = process.env
126
+ this.info.shell_env = vars
127
+ }
94
128
  }
95
129
  module.exports = Sysinfo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "1.1.20",
3
+ "version": "1.1.22",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {