Class: Installation::SnapshotsFinish

Inherits:
FinishClient
  • Object
show all
Includes:
Yast::I18n
Defined in:
src/lib/installation/snapshots_finish.rb

Instance Method Summary collapse

Constructor Details

#initializeSnapshotsFinish

Returns a new instance of SnapshotsFinish.



11
12
13
14
15
16
17
18
19
# File 'src/lib/installation/snapshots_finish.rb', line 11

def initialize
  super
  textdomain "installation"

  Yast.import "Mode"
  Yast.import "InstFunctions"
  Yast.import "Report"
  Yast.include self, "installation/misc.rb"
end

Instance Method Details

#titleObject



51
52
53
# File 'src/lib/installation/snapshots_finish.rb', line 51

def title
  _("Creating root filesystem snapshot...")
end

#writeTrueClass, FalseClass

Writes configuration

It finishes the Snapper configuration, if needed.

It also creates a snapshot when no second stage is required and Snapper is configured.

Returns:

  • (TrueClass, FalseClass)

    True if snapshot was created; otherwise it returns false.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'src/lib/installation/snapshots_finish.rb', line 30

def write
  snapper_config

  skip_reason = nil
  skip_reason = "no second stage" if InstFunctions.second_stage_required?
  skip_reason = "snapper is not configured" unless Yast2::FsSnapshot.configured?
  skip_reason = "root file system is read-only" if ro_root_fs?

  if skip_reason
    log.info("Skipping root filesystem snapshot creation: #{skip_reason}")
    return false
  end

  log.info("Creating root filesystem snapshot")
  if Mode.update
    create_post_snapshot
  else
    create_single_snapshot
  end
end