Class: Yast::HWConfigClass
- Inherits:
-
Module
- Object
- Module
- Yast::HWConfigClass
- Defined in:
- library/system/src/modules/HWConfig.rb
Instance Method Summary collapse
-
#ConfigFiles ⇒ Array<String>
Return list of all available hardware configuration files.
-
#Flush ⇒ Object
Flush - write the changes to files.
-
#GetComment(file, variable) ⇒ String
Get comment of the variable from the config file.
-
#GetValue(file, variable) ⇒ String
Set comment of the variable in the config file.
- #main ⇒ Object
-
#RemoveConfig(file) ⇒ Object
Remove configuration file from system.
-
#SetComment(file, variable, comment) ⇒ Boolean
Set comment of the variable in the config file.
-
#SetValue(file, variable, value) ⇒ Boolean
Set value of the variable in the config file.
-
#Values(file) ⇒ Hash
Read all values from the file.
-
#Variables(file) ⇒ Array<String>
Return list of all available variable in the configuration file.
Instance Method Details
#ConfigFiles ⇒ Array<String>
Return list of all available hardware configuration files
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'library/system/src/modules/HWConfig.rb', line 47 def ConfigFiles # read all files all = SCR.Dir(path(".sysconfig.hardware.section")) all = [] if all.nil? modules = Builtins.filter(all) do |file| !Builtins.regexpmatch(file, "[~]") end Builtins.y2debug("config files=%1", modules) deep_copy(all) end |
#Flush ⇒ Object
Flush - write the changes to files
155 156 157 158 |
# File 'library/system/src/modules/HWConfig.rb', line 155 def Flush # save all changes SCR.Write(path(".sysconfig.hardware"), nil) end |
#GetComment(file, variable) ⇒ String
Get comment of the variable from the config file
133 134 135 136 137 138 139 140 141 142 |
# File 'library/system/src/modules/HWConfig.rb', line 133 def GetComment(file, variable) Convert.to_string( SCR.Read( Ops.add( Ops.add(path(".sysconfig.hardware.value_comment"), file), variable ) ) ) end |
#GetValue(file, variable) ⇒ String
Set comment of the variable in the config file
106 107 108 109 110 111 112 |
# File 'library/system/src/modules/HWConfig.rb', line 106 def GetValue(file, variable) Convert.to_string( SCR.Read( Ops.add(Ops.add(path(".sysconfig.hardware.value"), file), variable) ) ) end |
#main ⇒ Object
41 42 43 |
# File 'library/system/src/modules/HWConfig.rb', line 41 def main textdomain "base" end |
#RemoveConfig(file) ⇒ Object
Remove configuration file from system
147 148 149 150 151 |
# File 'library/system/src/modules/HWConfig.rb', line 147 def RemoveConfig(file) p = Ops.add(path(".sysconfig.hardware.section"), file) Builtins.y2debug("deleting: %1", file) SCR.Write(p, nil) end |
#SetComment(file, variable, comment) ⇒ Boolean
Set comment of the variable in the config file
119 120 121 122 123 124 125 126 127 |
# File 'library/system/src/modules/HWConfig.rb', line 119 def SetComment(file, variable, comment) SCR.Write( Ops.add( Ops.add(path(".sysconfig.hardware.value_comment"), file), variable ), comment ) end |
#SetValue(file, variable, value) ⇒ Boolean
Set value of the variable in the config file
95 96 97 98 99 100 |
# File 'library/system/src/modules/HWConfig.rb', line 95 def SetValue(file, variable, value) SCR.Write( Ops.add(Ops.add(path(".sysconfig.hardware.value"), file), variable), value ) end |
#Values(file) ⇒ Hash
Read all values from the file
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'library/system/src/modules/HWConfig.rb', line 77 def Values(file) vars = Variables(file) ret = {} p = Ops.add(path(".sysconfig.hardware.value"), file) Builtins.maplist(vars) do |var| item = Convert.to_string(SCR.Read(Ops.add(p, var))) Ops.set(ret, var, item) if !item.nil? end deep_copy(ret) end |
#Variables(file) ⇒ Array<String>
Return list of all available variable in the configuration file
65 66 67 68 69 70 71 72 |
# File 'library/system/src/modules/HWConfig.rb', line 65 def Variables(file) p = Ops.add(path(".sysconfig.hardware.value"), file) values = SCR.Dir(p) Builtins.y2debug("values=%1", values) deep_copy(values) end |