Class: Yast::OSReleaseClass
- Inherits:
-
Module
- Object
- Module
- Yast::OSReleaseClass
- Includes:
- Logger
- Defined in:
- library/general/src/modules/OSRelease.rb
Constant Summary collapse
- OS_RELEASE_PATH =
"/etc/os-release".freeze
Instance Method Summary collapse
-
#id(directory = "/") ⇒ String
Get information about OS ID Is limited for the currently running product.
-
#initialize ⇒ OSReleaseClass
constructor
A new instance of OSReleaseClass.
-
#os_release_exists?(directory = "/") ⇒ Boolean
Returns whether os-release file exists in the given directory.
-
#ReleaseInformation(directory = "/") ⇒ String
Get information about the OS release Throws exception Yast::OSReleaseFileMissingError if release file is missing.
-
#ReleaseName(directory = "/") ⇒ String
Get information about the OS name Is limited for the currently running product.
-
#ReleaseVersion(directory = "/") ⇒ String
Get information about the OS version (technical).
-
#ReleaseVersionHumanReadable(directory = "/") ⇒ String
Get information about the OS version (human readable).
Constructor Details
#initialize ⇒ OSReleaseClass
Returns a new instance of OSReleaseClass.
38 39 40 41 42 |
# File 'library/general/src/modules/OSRelease.rb', line 38 def initialize super textdomain "base" end |
Instance Method Details
#id(directory = "/") ⇒ String
Get information about OS ID Is limited for the currently running product
90 91 92 |
# File 'library/general/src/modules/OSRelease.rb', line 90 def id(directory = "/") Misc.CustomSysconfigRead("ID", "", File.join(directory, OS_RELEASE_PATH)) end |
#os_release_exists?(directory = "/") ⇒ Boolean
Returns whether os-release file exists in the given directory
98 99 100 101 102 |
# File 'library/general/src/modules/OSRelease.rb', line 98 def os_release_exists?(directory = "/") FileUtils.Exists( File.join(directory, OS_RELEASE_PATH) ) end |
#ReleaseInformation(directory = "/") ⇒ String
Get information about the OS release Throws exception Yast::OSReleaseFileMissingError if release file is missing.
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'library/general/src/modules/OSRelease.rb', line 52 def ReleaseInformation(directory = "/") release_file = File.join(directory, OS_RELEASE_PATH) if !os_release_exists?(directory) log.info "Release file #{release_file} not found" raise( OSReleaseFileMissingError, format(_("Release file %{file} not found"), file: release_file) ) end MakeNiceName(Misc.CustomSysconfigRead("PRETTY_NAME", "", release_file)) end |
#ReleaseName(directory = "/") ⇒ String
Get information about the OS name Is limited for the currently running product
69 70 71 |
# File 'library/general/src/modules/OSRelease.rb', line 69 def ReleaseName(directory = "/") Misc.CustomSysconfigRead("NAME", "SUSE Linux", File.join(directory, OS_RELEASE_PATH)) end |
#ReleaseVersion(directory = "/") ⇒ String
Get information about the OS version (technical). E.g. 15.2 Is limited for the currently running product
76 77 78 |
# File 'library/general/src/modules/OSRelease.rb', line 76 def ReleaseVersion(directory = "/") Misc.CustomSysconfigRead("VERSION_ID", "", File.join(directory, OS_RELEASE_PATH)) end |
#ReleaseVersionHumanReadable(directory = "/") ⇒ String
Get information about the OS version (human readable). E.g. 15-SP2 Is limited for the currently running product
83 84 85 |
# File 'library/general/src/modules/OSRelease.rb', line 83 def ReleaseVersionHumanReadable(directory = "/") Misc.CustomSysconfigRead("VERSION", "", File.join(directory, OS_RELEASE_PATH)) end |