11export type SupervisorMetadata = {
22 uuid : string ;
3- serviceName : string ;
43} ;
54
5+ const SUPERVISOR_SVC_NAMES = [ 'main' , 'balena-supervisor' , 'core' ] ;
6+
67/**
78 * Although it might feel unsettling to hardcode these ids here.
89 * the main purpose of app uuids is to have environment independent
@@ -13,31 +14,16 @@ export type SupervisorMetadata = {
1314 * This will only be necessary until the supervisor becomes an actual app
1415 * on balena
1516 */
16- const SUPERVISOR_APPS : { [ arch : string ] : SupervisorMetadata } = {
17- amd64 : {
18- uuid : '52e35121417640b1b28a680504e4039b' ,
19- serviceName : 'balena-supervisor' ,
20- } ,
21- aarch64 : {
22- uuid : '900de4f3cbac4b9bbd232885a35e407b' ,
23- serviceName : 'balena-supervisor' ,
24- } ,
25- armv7hf : {
26- uuid : '2e66a95795c149959c69472a8c2f92b8' ,
27- serviceName : 'balena-supervisor' ,
28- } ,
29- i386 : {
30- uuid : '531b357e155c480cbec0fdd33041a1f5' ,
31- serviceName : 'balena-supervisor' ,
32- } ,
33- rpi : {
34- uuid : '6822565f766e413e96d9bebe2227cdcc' ,
35- serviceName : 'balena-supervisor' ,
36- } ,
17+ const SUPERVISOR_APPS : { [ arch : string ] : string } = {
18+ amd64 : '52e35121417640b1b28a680504e4039b' ,
19+ aarch64 : '900de4f3cbac4b9bbd232885a35e407b' ,
20+ armv7hf : '2e66a95795c149959c69472a8c2f92b8' ,
21+ i386 : '531b357e155c480cbec0fdd33041a1f5' ,
22+ rpi : '6822565f766e413e96d9bebe2227cdcc' ,
3723} ;
3824
3925export function isSupervisorApp ( appUuid : string ) : boolean {
40- return Object . values ( SUPERVISOR_APPS ) . some ( ( { uuid } ) => uuid === appUuid ) ;
26+ return Object . values ( SUPERVISOR_APPS ) . some ( ( uuid ) => uuid === appUuid ) ;
4127}
4228
4329/**
@@ -49,13 +35,8 @@ export function isSupervisorApp(appUuid: string): boolean {
4935 *
5036 * TODO: remove this once the supervisor knows how to update itself
5137 */
52-
5338export const isSupervisor = ( appUuid : string , svcName : string ) => {
54- return (
55- Object . values ( SUPERVISOR_APPS ) . filter (
56- ( { uuid, serviceName } ) =>
57- // Compare with `main` as well for compatibility with older supervisors
58- appUuid === uuid && ( svcName === serviceName || svcName === 'main' ) ,
59- ) . length > 0
39+ return Object . values ( SUPERVISOR_APPS ) . some (
40+ ( uuid ) => appUuid === uuid && SUPERVISOR_SVC_NAMES . includes ( svcName ) ,
6041 ) ;
6142} ;
0 commit comments