Module: Yast::AddOnMiscInclude

Defined in:
src/include/add-on/misc.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) ContinueIfInsufficientMemory



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'src/include/add-on/misc.rb', line 62

def ContinueIfInsufficientMemory
  Builtins.y2warning("Not enough memory!")

  # If already reported, just continue
  if !AddOnProduct.low_memory_already_reported
    # report it only once
    AddOnProduct.low_memory_already_reported = true

    if Popup.YesNoHeadline(
        # TRANSLATORS: pop-up headline
        _("Warning: Not enough memory!"),
        # TRANSLATORS: pop-up question
        _(
          "Your system does not seem to have enough memory to use add-on products\n" +
            "during installation. You can enable add-on products later when the\n" +
            "system is running.\n" +
            "\n" +
            "Do you want to skip using add-on products?"
        )
      )
      Builtins.y2milestone("User decided to skip Add-Ons")
      AddOnProduct.skip_add_ons = true

      return false
    else
      Builtins.y2warning(
        "User decided to continue with not enough memory...!"
      )

      return true
    end
  end

  true
end

- (Boolean) HasInsufficientMemory

Returns whether the machine has insufficient memory for using Add-Ons (in inst-sys).

Returns:

  • (Boolean)

    has insufficient memory



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'src/include/add-on/misc.rb', line 30

def HasInsufficientMemory
  # 384 MB - 5% (bugzilla #239630)
  enough_memory = 373000

  meminfo = Convert.to_map(SCR.Read(path(".proc.meminfo")))
  totalmem = Ops.add(
    Ops.get_integer(meminfo, "memtotal", 0),
    Ops.get_integer(meminfo, "swaptotal", 0)
  )

  Builtins.y2milestone(
    "Memory: %1, Swap: %2, Total: %3",
    Ops.get_integer(meminfo, "memtotal", 0),
    Ops.get_integer(meminfo, "swaptotal", 0),
    totalmem
  )

  # something is wrong
  if totalmem == nil
    # using only RAM if possible
    if Ops.get(meminfo, "memtotal") != nil
      totalmem = Ops.get_integer(meminfo, "memtotal", 0) 
      # can't do anything, just assume we enough
    else
      totalmem = enough_memory
    end
  end

  # do we have less memory than needed?
  Ops.less_than(totalmem, enough_memory)
end

- (Object) initialize_add_on_misc(include_target)



18
19
20
21
22
23
24
# File 'src/include/add-on/misc.rb', line 18

def initialize_add_on_misc(include_target)

  textdomain "add-on"

  Yast.import "AddOnProduct"
  Yast.import "Popup"
end