Class: Bootloader::FinishClient

Inherits:
Installation::FinishClient
  • Object
show all
Includes:
Yast::I18n
Defined in:
src/lib/bootloader/finish_client.rb

Overview

Finish client for bootloader configuration

Instance Method Summary collapse

Constructor Details

#initializeFinishClient

Returns a new instance of FinishClient.



20
21
22
23
24
# File 'src/lib/bootloader/finish_client.rb', line 20

def initialize
  textdomain "bootloader"

  super
end

Instance Method Details

#modesObject



34
35
36
# File 'src/lib/bootloader/finish_client.rb', line 34

def modes
  [:installation, :live_installation, :update, :autoinst]
end

#stepsObject



26
27
28
# File 'src/lib/bootloader/finish_client.rb', line 26

def steps
  3
end

#titleObject



30
31
32
# File 'src/lib/bootloader/finish_client.rb', line 30

def title
  _("Saving bootloader configuration...")
end

#writeObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'src/lib/bootloader/finish_client.rb', line 38

def write
  # message after first round of packet installation
  # now the installed system is run and more packages installed
  # just warn the user that the screen is going back to text mode
  # and yast2 will come up again.
  set_boot_msg

  bl_current = ::Bootloader::BootloaderFactory.current
  # we do nothing in upgrade unless we have to change bootloader
  return true if Yast::Mode.update && !bl_current.read? && !bl_current.proposed?

  # we do not manage bootloader, so relax :)
  return true if bl_current.name == "none"

  begin
    # read one from system, so we do not overwrite changes done in rpm post install scripts
    ::Bootloader::BootloaderFactory.clear_cache
    system = ::Bootloader::BootloaderFactory.system
    system.read
    system.merge(bl_current)
    system.write
  rescue BrokenConfiguration => e
    # bug#1138930: although there should never be errors in this phase
    # (unless udev is broken), aborting the installation is not nice
    Yast::Report.LongMessage(e.message)
  end

  # and remember result of merge as current one
  ::Bootloader::BootloaderFactory.current = system

  if !BootloaderFactory.current.is_a?(SystemdBoot)
    # Not for SystemdBoot bootloader because
    # kexec and dracut regeneration will be done by sdbootutil directly.

    # fate #303395: Use kexec to avoid booting between first and second stage
    # copy vmlinuz, initrd and flush kernel option into /var/lib/YaST2
    if Yast::Linuxrc.InstallInf("kexec_reboot") == "1"
      kexec = ::Bootloader::Kexec.new
      kexec.prepare_environment
    else
      log.info "Installation started with kexec_reboot set 0"
    end

    # call dracut to ensure initrd is properly set, it is especially needed
    # in live system install ( where it is just copyied ) and image based
    # installation where post install script is not executed
    # (bnc#979719,bnc#977656, bsc#1189374)
    # --regenerate-all is needed for generating initrd image for all kernels (bsc#1189915)
    Yast::Execute.on_target("/usr/bin/dracut", "--force", "--regenerate-all")
  end

  true
end