Class: Yast::LinuxrcClass

Inherits:
Module
  • Object
show all
Defined in:
../../library/general/src/modules/Linuxrc.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) braille

braille mode ?



100
101
102
# File '../../library/general/src/modules/Linuxrc.rb', line 100

def braille
  InstallInf("Braille") != nil
end

- (Object) display_ip

remote X mode ?



109
110
111
# File '../../library/general/src/modules/Linuxrc.rb', line 109

def display_ip
  InstallInf("Display_IP") != nil
end

- (Object) InstallInf(key)



72
73
74
75
# File '../../library/general/src/modules/Linuxrc.rb', line 72

def InstallInf(key)
  ReadInstallInf() if @install_inf == nil
  Ops.get(@install_inf, key)
end

- (Object) main



34
35
36
37
38
39
40
41
# File '../../library/general/src/modules/Linuxrc.rb', line 34

def main
  Yast.import "Mode"
  Yast.import "Stage"

  @install_inf = nil

  @_manual = nil
end

- (Object) manual

installation mode wrappers



79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File '../../library/general/src/modules/Linuxrc.rb', line 79

def manual
  return @_manual if @_manual != nil
  @_manual = InstallInf("Manual") == "1"
  if !@_manual
    tmp = Convert.to_string(
      SCR.Read(path(".target.string"), "/proc/cmdline")
    )
    if tmp != nil &&
        Builtins.contains(Builtins.splitstring(tmp, " \n"), "manual")
      @_manual = true
    end
  end
  @_manual
end

- (Object) ReadInstallInf

routines for reading data from /etc/install.inf



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File '../../library/general/src/modules/Linuxrc.rb', line 45

def ReadInstallInf
  @install_inf = {}
  # don't read anything if the file doesn't exist
  if SCR.Read(path(".target.size"), "/etc/install.inf") == -1
    Builtins.y2error("Reading install.inf, but file doesn't exist!!!")
    return
  end
  entries = SCR.Dir(path(".etc.install_inf"))
  if entries == nil
    Builtins.y2error("install.inf is empty")
    return
  end
  Builtins.foreach(entries) do |e|
    val = Convert.to_string(
      SCR.Read(Builtins.add(path(".etc.install_inf"), e))
    )
    Ops.set(@install_inf, e, val)
  end

  nil
end

- (Object) ResetInstallInf



67
68
69
70
# File '../../library/general/src/modules/Linuxrc.rb', line 67

def ResetInstallInf
  @install_inf = nil
  nil
end

- (Object) SaveInstallInf(root)

Copy /etc/install.inf into built system so that the second phase of the installation can find it.

Parameters:

  • root

    mount point of system

Returns:

  • boolean true on success



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File '../../library/general/src/modules/Linuxrc.rb', line 155

def SaveInstallInf(root)
  if Stage.initial && !Mode.test
    inst_if_file = "/etc/install.inf"

    if root != nil && root != "" && root != "/"
      if WFM.Read(path(".local.size"), inst_if_file) != -1
        Builtins.y2milestone("Copying %1 to %2", inst_if_file, root)
        if Convert.to_integer(
            WFM.Execute(
              path(".local.bash"),
              Builtins.sformat(
                "grep -vi '^Sourcemounted' '%1' > %2/%1; chmod 0600 %2/%1",
                inst_if_file,
                root
              )
            )
          ) != 0
          Builtins.y2error(
            "Cannot SaveInstallInf %1 to %2",
            inst_if_file,
            root
          )
        end
      else
        Builtins.y2error(
          "Can't SaveInstallInf, file %1 doesn't exist",
          inst_if_file
        )
      end
    else
      Builtins.y2error("Can't SaveInstallInf, root is %1", root)
    end

    # just for debug so we can see the original install.inf later
    SCR.Execute(
      path(".target.bash"),
      Ops.add(
        Ops.add("/bin/cp /etc/install.inf ", root),
        "/var/lib/YaST2/install.inf"
      )
    )
    SCR.Execute(
      path(".target.bash"),
      Ops.add(
        Ops.add("/bin/chmod 0600 ", root),
        "/var/lib/YaST2/install.inf"
      )
    )
  end
  true
end

- (Object) serial_console

running via serial console



95
96
97
# File '../../library/general/src/modules/Linuxrc.rb', line 95

def serial_console
  InstallInf("Console") != nil
end

- (Object) text

we're running in textmode (-> UI::GetDisplayInfo())



127
128
129
# File '../../library/general/src/modules/Linuxrc.rb', line 127

def text
  InstallInf("Textmode") == "1"
end

- (Object) useiscsi

Returns if iSCSI has been requested in Linuxrc.



122
123
124
# File '../../library/general/src/modules/Linuxrc.rb', line 122

def useiscsi
  InstallInf("WithiSCSI") == "1"
end

- (Object) usessh

ssh mode ? if booted with 'vnc=1 usessh=1', keep vnc mode, but start sshd if booted with 'display_ip=1.2.3.4 usessh=1', keep remote X mode, but start sshd this has to be checked by the caller, not here



117
118
119
# File '../../library/general/src/modules/Linuxrc.rb', line 117

def usessh
  InstallInf("UseSSH") == "1"
end

- (Object) vnc

vnc mode ?



105
106
107
# File '../../library/general/src/modules/Linuxrc.rb', line 105

def vnc
  InstallInf("VNC") == "1"
end

- (void) WriteYaSTInf(linuxrc)

This method returns an undefined value.

Write /etc/yast.inf during installation

Parameters:

  • linuxrc (Hash{String => String})

    map of key value pairs for /etc/yast.inf



136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File '../../library/general/src/modules/Linuxrc.rb', line 136

def WriteYaSTInf(linuxrc)
  linuxrc = deep_copy(linuxrc)
  yast_inf = ""
  Builtins.foreach(linuxrc) do |ykey, yvalue|
    yast_inf = Ops.add(
      Ops.add(Ops.add(Ops.add(yast_inf, ykey), ": "), yvalue),
      "\n"
    )
  end
  Builtins.y2milestone("WriteYaSTInf(%1) = %2", linuxrc, yast_inf)

  WFM.Write(path(".local.string"), "/etc/yast.inf", yast_inf) if !Mode.test
  nil
end