Module: Yast::PartitioningPartitionDefinesInclude

Defined in:
../../src/include/partitioning/partition_defines.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) initialize_partitioning_partition_defines(include_target)



28
29
30
31
32
33
# File '../../src/include/partitioning/partition_defines.rb', line 28

def initialize_partitioning_partition_defines(include_target)
  Yast.import "Mode"
  Yast.import "FileSystems"

  textdomain "storage"
end

- (Object) notUsedMountpoints(targetMap, all_mountpoints)

——————————————————————— get a list of not used mountpoints ———————————— in: targetMap out: list of mountpoints for a combobox [“/usr”,“/opt”, …] ———————————————————————



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File '../../src/include/partitioning/partition_defines.rb', line 42

def notUsedMountpoints(targetMap, all_mountpoints)
  targetMap = deep_copy(targetMap)
  all_mountpoints = deep_copy(all_mountpoints)
  if all_mountpoints == [] || all_mountpoints == nil
    all_mountpoints = FileSystems.SuggestMPoints
  end


  mountpoints = Builtins.maplist(targetMap) do |dev, devmap|
    Builtins.maplist(Ops.get_list(devmap, "partitions", [])) do |part|
      Ops.get_string(part, "mount", "")
    end
  end

  mountpoints = Builtins.flatten(
    Convert.convert(mountpoints, :from => "list", :to => "list <list>")
  )
  mountpoints = Builtins.union(mountpoints, []) # remove double entrys "" and swap

  not_used_mountpoints = Builtins.filter(all_mountpoints) do |mnt|
    !Builtins.contains(mountpoints, mnt)
  end

  deep_copy(not_used_mountpoints)
end

- (Object) PartedSizeToCly(win_size_f, cyl_size)

////////////////////////////////////////////////////////////////////// input: win_size_f: new size of wimdows partion in bytes as float cyl_size : cylinder size

output: lentgh of win-region in cylinder



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File '../../src/include/partitioning/partition_defines.rb', line 76

def PartedSizeToCly(win_size_f, cyl_size)
  win_size_f = deep_copy(win_size_f)
  new_length_f = Ops.divide(win_size_f, Builtins.tofloat(cyl_size))
  new_length_i = Builtins.tointeger(new_length_f)

  Builtins.y2debug(
    "new_length_f: <%1> - new_length_i: <%2>",
    new_length_f,
    new_length_i
  )

  if Builtins.tofloat(new_length_f) != Builtins.tofloat(new_length_i)
    new_length_i = Ops.add(new_length_i, 1) # add 1 cylinder if there is a residual
  end

  new_length_i
end

- (Object) SingleMountPointProposal

Make a proposal for a single mountpoint (first free on the list in installation, empty string otherwise)



99
100
101
102
103
104
105
106
107
108
109
# File '../../src/include/partitioning/partition_defines.rb', line 99

def SingleMountPointProposal
  if Mode.normal
    return ""
  else
    free_list = notUsedMountpoints(
      Storage.GetTargetMap,
      FileSystems.SuggestMPoints
    )
    return Ops.get_string(free_list, 0, "")
  end
end