Class: Yast::AutoinstImageClass

Inherits:
Module
  • Object
show all
Defined in:
../../src/modules/AutoinstImage.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) getScript



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File '../../src/modules/AutoinstImage.rb', line 24

def getScript
  ret = false
  if Ops.get_string(AutoinstSoftware.image, "script_location", "") != ""
    urltok = {}

    urltok = URL.Parse(
      Ops.get_string(AutoinstSoftware.image, "script_location", "")
    )
    scheme = Ops.get_string(urltok, "scheme", "default")
    host = Ops.get_string(urltok, "host", "")
    filepath = Ops.get_string(urltok, "path", "")
    ret = Get(scheme, host, filepath, "/tmp/image.sh")
  elsif Ops.get_string(AutoinstSoftware.image, "script_source", "") != ""
    SCR.Write(
      path(".target.string"),
      "/tmp/image.sh",
      Ops.get_string(AutoinstSoftware.image, "script_source", "")
    )
    ret = true
  end
  ret
end

- (Object) main



13
14
15
16
17
18
19
20
21
22
# File '../../src/modules/AutoinstImage.rb', line 13

def main
  textdomain "autoinst"

  Yast.import "Progress"
  Yast.import "AutoinstConfig"
  Yast.import "URL"
  Yast.import "AutoinstSoftware"

  Yast.include self, "autoinstall/io.rb"
end

- (Object) runScript



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File '../../src/modules/AutoinstImage.rb', line 47

def runScript
  params = Builtins.mergestring(
    Ops.get_list(AutoinstSoftware.image, "script_params", []),
    " "
  )
  Convert.to_integer(
    SCR.Execute(
      path(".target.bash"),
      Builtins.sformat(
        "/bin/sh -x /tmp/image.sh %1 > /tmp/ayast_image.log 2>&1",
        params
      )
    )
  )
end