Class: Yast::StorageUtilsClass

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) ConfigureSnapper



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

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

- (Object) main



34
35
36
37
38
39
40
# File '../../src/modules/StorageUtils.rb', line 34

def main

  textdomain "storage"

  Yast.import "Storage"

end