Class: Yast::StorageSnapperClass
- Inherits:
-
Module
- Object
- Module
- Yast::StorageSnapperClass
- Includes:
- Logger
- Defined in:
- ../../src/modules/StorageSnapper.rb
Instance Method Summary (collapse)
- - (Object) bash_log_output(command)
- - (Boolean) configure_snapper?
- - (Object) configure_snapper_step1
- - (Object) configure_snapper_step2
- - (Object) configure_snapper_step3
- - (Object) configure_snapper_step4
- - (Object) main
Instance Method Details
- (Object) bash_log_output(command)
45 46 47 48 49 50 51 52 53 |
# File '../../src/modules/StorageSnapper.rb', line 45 def bash_log_output(command) tmp = SCR.Execute(path(".target.bash_output"), command) log.info("exit: #{tmp.fetch("exit")}") tmp.fetch("stdout").each_line { |line| log.info("stdout #{line}") } tmp.fetch("stderr").each_line { |line| log.info("stderr #{line}") } return tmp.fetch("exit") end |
- (Boolean) configure_snapper?
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File '../../src/modules/StorageSnapper.rb', line 56 def configure_snapper? part = Storage.GetEntryForMountpoint("/") if part.fetch("used_fs", :unknown) != :btrfs return false end userdata = part.fetch("userdata", {}) if userdata.fetch("/", "") != "snapshots" return false end return true end |
- (Object) configure_snapper_step1
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File '../../src/modules/StorageSnapper.rb', line 74 def configure_snapper_step1() log.info("configuring snapper for root fs - step 1") part = Storage.GetEntryForMountpoint("/") if bash_log_output("/usr/lib/snapper/installation-helper --step 1 " << "--device '#{String.Quote(part["device"])}' " << "--description 'first root filesystem'") != 0 log.error("configuring snapper for root fs failed") end end |
- (Object) configure_snapper_step2
89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File '../../src/modules/StorageSnapper.rb', line 89 def configure_snapper_step2() log.info("configuring snapper for root fs - step 2") part = Storage.GetEntryForMountpoint("/") if bash_log_output("/usr/lib/snapper/installation-helper --step 2 " << "--device '#{String.Quote(part["device"])}' " << "--root-prefix '#{String.Quote(Installation.destdir)}' " << "--default-subvolume-name '#{String.Quote(Storage.default_subvolume_name())}'") != 0 log.error("configuring snapper for root fs failed") end end |
- (Object) configure_snapper_step3
105 106 107 108 109 110 111 112 113 114 115 |
# File '../../src/modules/StorageSnapper.rb', line 105 def configure_snapper_step3() log.info("configuring snapper for root fs - step 3") if bash_log_output("/usr/lib/snapper/installation-helper --step 3 " << "--root-prefix '#{String.Quote(Installation.destdir)}' " << "--default-subvolume-name '#{String.Quote(Storage.default_subvolume_name())}'") != 0 log.error("configuring snapper for root fs failed") end end |
- (Object) configure_snapper_step4
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File '../../src/modules/StorageSnapper.rb', line 118 def configure_snapper_step4() log.info("configuring snapper for root fs - step 4") if bash_log_output("/usr/lib/snapper/installation-helper --step 4") != 0 log.error("configuring snapper for root fs failed") end bash_log_output("/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) end |
- (Object) main
34 35 36 37 38 39 40 41 42 |
# File '../../src/modules/StorageSnapper.rb', line 34 def main textdomain "storage" Yast.import "String" Yast.import "Installation" Yast.import "Storage" end |