Class: Yast::HWConfigClass
- Inherits:
-
Module
- Object
- Module
- Yast::HWConfigClass
- Defined in:
- ../../src/modules/HWConfig.rb
Instance Method Summary (collapse)
-
- (Array<String>) ConfigFiles
Return list of all available hardware configuration files.
-
- (Object) Flush
Flush - write the changes to files.
-
- (String) GetComment(file, variable)
Get comment of the variable from the config file.
-
- (String) GetValue(file, variable)
Set comment of the variable in the config file.
- - (Object) main
-
- (Object) RemoveConfig(file)
Remove configuration file from system.
-
- (Boolean) SetComment(file, variable, comment)
Set comment of the variable in the config file.
-
- (Boolean) SetValue(file, variable, value)
Set value of the variable in the config file.
-
- (Hash) Values(file)
Read all values from the file.
-
- (Array<String>) Variables(file)
Return list of all available variable in the configuration file.
Instance Method Details
- (Array<String>) ConfigFiles
Return list of all available hardware configuration files
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File '../../src/modules/HWConfig.rb', line 49 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 |
- (Object) Flush
Flush - write the changes to files
157 158 159 160 |
# File '../../src/modules/HWConfig.rb', line 157 def Flush # save all changes SCR.Write(path(".sysconfig.hardware"), nil) end |
- (String) GetComment(file, variable)
Get comment of the variable from the config file
135 136 137 138 139 140 141 142 143 144 |
# File '../../src/modules/HWConfig.rb', line 135 def GetComment(file, variable) Convert.to_string( SCR.Read( Ops.add( Ops.add(path(".sysconfig.hardware.value_comment"), file), variable ) ) ) end |
- (String) GetValue(file, variable)
Set comment of the variable in the config file
108 109 110 111 112 113 114 |
# File '../../src/modules/HWConfig.rb', line 108 def GetValue(file, variable) Convert.to_string( SCR.Read( Ops.add(Ops.add(path(".sysconfig.hardware.value"), file), variable) ) ) end |
- (Object) main
43 44 45 |
# File '../../src/modules/HWConfig.rb', line 43 def main textdomain "base" end |
- (Object) RemoveConfig(file)
Remove configuration file from system
149 150 151 152 153 |
# File '../../src/modules/HWConfig.rb', line 149 def RemoveConfig(file) p = Ops.add(path(".sysconfig.hardware.section"), file) Builtins.y2debug("deleting: %1", file) SCR.Write(p, nil) end |
- (Boolean) SetComment(file, variable, comment)
Set comment of the variable in the config file
121 122 123 124 125 126 127 128 129 |
# File '../../src/modules/HWConfig.rb', line 121 def SetComment(file, variable, comment) SCR.Write( Ops.add( Ops.add(path(".sysconfig.hardware.value_comment"), file), variable ), comment ) end |
- (Boolean) SetValue(file, variable, value)
Set value of the variable in the config file
97 98 99 100 101 102 |
# File '../../src/modules/HWConfig.rb', line 97 def SetValue(file, variable, value) SCR.Write( Ops.add(Ops.add(path(".sysconfig.hardware.value"), file), variable), value ) end |
- (Hash) Values(file)
Read all values from the file
79 80 81 82 83 84 85 86 87 88 89 90 |
# File '../../src/modules/HWConfig.rb', line 79 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 |
- (Array<String>) Variables(file)
Return list of all available variable in the configuration file
67 68 69 70 71 72 73 74 |
# File '../../src/modules/HWConfig.rb', line 67 def Variables(file) p = Ops.add(path(".sysconfig.hardware.value"), file) values = SCR.Dir(p) Builtins.y2debug("values=%1", values) deep_copy(values) end |