1
- import fs from 'fs ' ;
1
+ import sdk from '@scrypted/sdk ' ;
2
2
import child_process from 'child_process' ;
3
3
import { once } from 'events' ;
4
- import sdk from '@scrypted/sdk ' ;
5
- import { stdout } from 'process ' ;
4
+ import fs from 'fs ' ;
5
+ import os from 'os ' ;
6
6
7
7
export const SCRYPTED_INSTALL_ENVIRONMENT_LXC = 'lxc' ;
8
8
@@ -43,38 +43,51 @@ export async function checkLxcDependencies() {
43
43
}
44
44
45
45
try {
46
- // intel opencl icd is broken from their official apt repos on kernel versions 6.8, which ships with ubuntu 24.04 and proxmox 8.2.
47
- // the intel apt repo has not been updated yet.
48
- // the current workaround is to install the release manually.
49
- // https://github.com/intel/compute-runtime/releases/tag/24.13.29138.7
50
- const output = await new Promise < string > ( ( r , f ) => child_process . exec ( "sh -c 'apt show versions intel-opencl-icd'" , ( err , stdout , stderr ) => {
46
+ const output = await new Promise < string > ( ( r , f ) => child_process . exec ( "sh -c 'apt show versions level-zero'" , ( err , stdout , stderr ) => {
51
47
if ( err && ! stdout && ! stderr )
52
48
f ( err ) ;
53
49
else
54
50
r ( stdout + '\n' + stderr ) ;
55
51
} ) ) ;
56
52
57
- if (
58
- // apt
59
- output . includes ( 'Version: 23' )
60
- // was installed via script at some point
61
- || output . includes ( 'Version: 24.13.29138.7' )
62
- // current script version: 24.17.29377.6
53
+ const cpuModel = os . cpus ( ) [ 0 ] . model ;
54
+ if ( cpuModel . includes ( 'Core' ) && cpuModel . includes ( 'Ultra' ) ) {
55
+ if (
56
+ // apt
57
+ output . includes ( 'No packages found' )
63
58
) {
64
- const cp = child_process . spawn ( 'sh' , [ '-c' , 'curl https://raw.githubusercontent.com/koush/scrypted/main/install/docker/install-intel-graphics.sh | bash' ] ) ;
65
- const [ exitCode ] = await once ( cp , 'exit' ) ;
66
- if ( exitCode !== 0 )
67
- sdk . log . a ( 'Failed to install intel-opencl-icd.' ) ;
68
- else
69
- needRestart = true ;
59
+ const cp = child_process . spawn ( 'sh' , [ '-c' , 'curl https://raw.githubusercontent.com/koush/scrypted/main/install/docker/install-intel-npu.sh | bash' ] ) ;
60
+ const [ exitCode ] = await once ( cp , 'exit' ) ;
61
+ if ( exitCode !== 0 )
62
+ sdk . log . a ( 'Failed to install intel-driver-compiler-npu.' ) ;
63
+ else
64
+ needRestart = true ;
65
+ }
66
+ }
67
+ else {
68
+ // level-zero crashes openvino on older CPU due to illegal instruction.
69
+ // so ensure it is not installed if this is not a core ultra system with npu.
70
+ if (
71
+ // apt
72
+ ! output . includes ( 'No packages found' )
73
+ ) {
74
+ const cp = child_process . spawn ( 'apt' , [ '-y' , 'remove' , 'level-zero' ] ) ;
75
+ const [ exitCode ] = await once ( cp , 'exit' ) ;
76
+ console . log ( 'level-zero removed' , exitCode ) ;
77
+ }
70
78
}
79
+
71
80
}
72
81
catch ( e ) {
73
- sdk . log . a ( 'Failed to verify/install intel-opencl-icd version .' ) ;
82
+ sdk . log . a ( 'Failed to verify/install intel-driver-compiler-npu .' ) ;
74
83
}
75
84
76
85
try {
77
- const output = await new Promise < string > ( ( r , f ) => child_process . exec ( "sh -c 'apt show versions intel-driver-compiler-npu'" , ( err , stdout , stderr ) => {
86
+ // intel opencl icd is broken from their official apt repos on kernel versions 6.8, which ships with ubuntu 24.04 and proxmox 8.2.
87
+ // the intel apt repo has not been updated yet.
88
+ // the current workaround is to install the release manually.
89
+ // https://github.com/intel/compute-runtime/releases/tag/24.13.29138.7
90
+ const output = await new Promise < string > ( ( r , f ) => child_process . exec ( "sh -c 'apt show versions intel-opencl-icd'" , ( err , stdout , stderr ) => {
78
91
if ( err && ! stdout && ! stderr )
79
92
f ( err ) ;
80
93
else
@@ -83,18 +96,21 @@ export async function checkLxcDependencies() {
83
96
84
97
if (
85
98
// apt
86
- output . includes ( 'No packages found' )
87
- ) {
88
- const cp = child_process . spawn ( 'sh' , [ '-c' , 'curl https://raw.githubusercontent.com/koush/scrypted/main/install/docker/install-intel-npu.sh | bash' ] ) ;
99
+ output . includes ( 'Version: 23' )
100
+ // was installed via script at some point
101
+ || output . includes ( 'Version: 24.13.29138.7' )
102
+ // current script version: 24.17.29377.6
103
+ ) {
104
+ const cp = child_process . spawn ( 'sh' , [ '-c' , 'curl https://raw.githubusercontent.com/koush/scrypted/main/install/docker/install-intel-graphics.sh | bash' ] ) ;
89
105
const [ exitCode ] = await once ( cp , 'exit' ) ;
90
106
if ( exitCode !== 0 )
91
- sdk . log . a ( 'Failed to install intel-driver-compiler-npu .' ) ;
107
+ sdk . log . a ( 'Failed to install intel-opencl-icd .' ) ;
92
108
else
93
109
needRestart = true ;
94
110
}
95
111
}
96
112
catch ( e ) {
97
- sdk . log . a ( 'Failed to verify/install intel-driver-compiler-npu .' ) ;
113
+ sdk . log . a ( 'Failed to verify/install intel-opencl-icd version .' ) ;
98
114
}
99
115
100
116
if ( needRestart )
0 commit comments