@@ -17,15 +17,15 @@ def self.load
17
17
18
18
plat . family ( "windows" ) . in_family ( "os" )
19
19
. detect do
20
- # Can't return from a `proc` thus the `is_windows` shenanigans
20
+ # Can't return from a `proc` thus the `is_windows` shenanigans
21
21
is_windows = false
22
22
is_windows = true if winrm?
23
23
24
24
if @backend . class . to_s == "Train::Transports::Local::Connection"
25
25
is_windows = true if ruby_host_os ( /mswin|mingw32|windows/ )
26
26
end
27
27
28
- # Try to detect windows even for ssh transport
28
+ # Try to detect windows even for ssh transport
29
29
if !is_windows && detect_windows == true
30
30
is_windows = true
31
31
end
@@ -41,8 +41,8 @@ def self.load
41
41
# unix master family
42
42
plat . family ( "unix" ) . in_family ( "os" )
43
43
. detect do
44
- # we want to catch a special case here where cisco commands
45
- # don't return an exit status and still print to stdout
44
+ # we want to catch a special case here where cisco commands
45
+ # don't return an exit status and still print to stdout
46
46
if unix_uname_s =~ /./ && !unix_uname_s . start_with? ( "Line has invalid autocommand " ) && !unix_uname_s . start_with? ( "The command you have entered" )
47
47
@platform [ :arch ] = unix_uname_m
48
48
true
@@ -92,7 +92,7 @@ def self.load
92
92
true
93
93
end
94
94
95
- # if we get this far we have to be some type of debian
95
+ # if we get this far we have to be some type of debian
96
96
@platform [ :release ] = unix_file_contents ( "/etc/debian_version" ) . chomp
97
97
true
98
98
end
@@ -136,9 +136,9 @@ def self.load
136
136
# redhat family
137
137
plat . family ( "redhat" ) . in_family ( "linux" )
138
138
. detect do
139
- # I am not sure this returns true for all redhats in this family
140
- # for now we are going to just try each platform
141
- # return true unless unix_file_contents('/etc/redhat-release').nil?
139
+ # I am not sure this returns true for all redhats in this family
140
+ # for now we are going to just try each platform
141
+ # return true unless unix_file_contents('/etc/redhat-release').nil?
142
142
143
143
true
144
144
end
@@ -318,16 +318,45 @@ def self.load
318
318
end
319
319
end
320
320
321
+ # yocto family
322
+ plat . family ( "yocto" ) . in_family ( "linux" )
323
+ . detect do
324
+ # /etc/issue isn't specific to yocto, but it's the only way to detect
325
+ # the platform because there are no other identifying files
326
+ if unix_file_contents ( "/etc/issue" ) &&
327
+ ( unix_file_contents ( "/etc/issue" ) . match? ( "Poky" ) ||
328
+ unix_file_contents ( "/etc/issue" ) . match? ( "balenaOS" ) )
329
+ true
330
+ end
331
+ end
332
+ plat . name ( "yocto" ) . title ( "Yocto Project Linux" ) . in_family ( "yocto" )
333
+ . detect do
334
+ if unix_file_contents ( "/etc/issue" ) . match? ( "Poky" )
335
+ # assuming the Poky version is preferred over the /etc/version build
336
+ @platform [ :release ] = unix_file_contents ( "/etc/issue" ) . match ( '\d+(\.\d+)+' ) [ 0 ]
337
+ true
338
+ end
339
+ end
340
+ plat . name ( "balenaos" ) . title ( "balenaOS Linux" ) . in_family ( "yocto" )
341
+ . detect do
342
+ # balenaOS does have the /etc/os-release file
343
+ if unix_file_contents ( "/etc/issue" ) . match? ( "balenaOS" ) &&
344
+ linux_os_release [ "NAME" ] =~ /balenaos/i
345
+ @platform [ :release ] = linux_os_release [ "META_BALENA_VERSION" ]
346
+ true
347
+ end
348
+ end
349
+
321
350
# brocade family detected here if device responds to 'uname' command,
322
351
# happens when logging in as root
323
352
plat . family ( "brocade" ) . title ( "Brocade Family" ) . in_family ( "linux" )
324
353
. detect do
325
354
!brocade_version . nil?
326
355
end
327
356
328
- # genaric linux
357
+ # generic linux
329
358
# this should always be last in the linux family list
330
- plat . name ( "linux" ) . title ( "Genaric Linux" ) . in_family ( "linux" )
359
+ plat . name ( "linux" ) . title ( "Generic Linux" ) . in_family ( "linux" )
331
360
. detect do
332
361
true
333
362
end
@@ -426,7 +455,7 @@ def self.load
426
455
true
427
456
end
428
457
429
- # must be some unknown solaris
458
+ # must be some unknown solaris
430
459
true
431
460
end
432
461
@@ -457,8 +486,8 @@ def self.load
457
486
# bsd family
458
487
plat . family ( "bsd" ) . in_family ( "unix" )
459
488
. detect do
460
- # we need a better way to determin this family
461
- # for now we are going to just try each platform
489
+ # we need a better way to determine this family
490
+ # for now we are going to just try each platform
462
491
true
463
492
end
464
493
plat . family ( "darwin" ) . in_family ( "bsd" )
@@ -484,7 +513,7 @@ def self.load
484
513
end
485
514
plat . name ( "darwin" ) . title ( "Darwin" ) . in_family ( "darwin" )
486
515
. detect do
487
- # must be some other type of darwin
516
+ # must be some other type of darwin
488
517
@platform [ :name ] = unix_uname_s . lines [ 0 ] . chomp
489
518
true
490
519
end
0 commit comments