Class: Yast::StorageUtilsClass

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) ConfigureSnapper



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File '../../src/modules/StorageUtils.rb', line 39

def ConfigureSnapper()
  part = Storage.GetEntryForMountpoint("/")
  if part.fetch("used_fs", :unknown) == :btrfs
    userdata = part.fetch("userdata", {})
    if userdata.fetch("/", "") == "snapshots"
      Builtins.y2milestone("configuring snapper for root fs")
      if SCR.Execute(path(".target.bash"), "/usr/bin/snapper --no-dbus create-config " <<
                     "--fstype=btrfs /") == 0
        SCR.Execute(path(".target.bash"), "/usr/bin/snapper --no-dbus set-config " <<
                    "NUMBER_CLEANUP=yes NUMBER_LIMIT=20 NUMBER_LIMIT_IMPORTANT=10")
        SCR.Write(path(".sysconfig.yast2.USE_SNAPPER"), "yes")
      else
        Builtins.y2error("configuring snapper for root fs failed")
      end
    end
  end
end

- (Object) main



30
31
32
33
34
35
36
# File '../../src/modules/StorageUtils.rb', line 30

def main

  textdomain "storage"

  Yast.import "Storage"

end