diff --git a/lib/train/platforms/detect/helpers/os_linux.rb b/lib/train/platforms/detect/helpers/os_linux.rb index 96a79a20..c77845e4 100644 --- a/lib/train/platforms/detect/helpers/os_linux.rb +++ b/lib/train/platforms/detect/helpers/os_linux.rb @@ -71,6 +71,17 @@ def lsb_release(content) codename: codename.nil? ? nil : codename[1], } end + + def amzn_release(content) + id = /^NAME=\s+(.+)$/.match(content) + release = /^PRETTY_NAME=\s+(.+)$/.match(content) + codename = /^CPE_NAME=\s+(.+)$/.match(content) + { + id: id.nil? ? nil : id[1], + release: release.nil? ? nil : release[1], + codename: codename.nil? ? nil : codename[1], + } + end def read_linux_lsb return @lsb unless @lsb.empty? @@ -79,6 +90,8 @@ def read_linux_lsb @lsb = lsb_config(raw) elsif !(raw = unix_file_contents("/usr/bin/lsb-release")).nil? @lsb = lsb_release(raw) + elsif !(raw = unix_file_contents("/etc/os-release")).nil? + @lsb = amzn_release(raw) end end end