Class: Yast::SaveY2logs

Inherits:
Client
  • Object
show all
Defined in:
src/lib/installation/clients/save_y2logs.rb

Instance Method Summary collapse

Instance Method Details

#mainObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'src/lib/installation/clients/save_y2logs.rb', line 8

def main
  Yast.import "Directory"
  Yast.import "Installation"
  Yast.import "ProductFeatures"

  return unless ProductFeatures.GetBooleanFeature("globals", "save_y2logs")

  target_path = ::File.join(
    Yast::Installation.destdir,
    Yast::Directory.logdir
  )

  # use the target /tmp when available to save memory
  target_tmp = File.join(Yast::Installation.destdir, "tmp")
  tmpdir = File.exist?(target_tmp) ? target_tmp : "/tmp"

  WFM.Execute(Yast::Path.new(".local.bash"),
    # set TMPDIR for `mktemp -d` so it uses the target disk, not inst-sys RAM disk
    # https://github.com/yast/yast-yast2/blob/482eecb6064e2a904864fdab17e8c4bed41065ff/scripts/save_y2logs#L72
    "TMPDIR=#{tmpdir} /usr/sbin/save_y2logs '#{target_path}/yast-installation-logs.tar.xz'")
end