Class: Installation::FinishClient

Inherits:
Yast::Client
  • Object
show all
Includes:
Yast::Logger
Defined in:
library/general/src/lib/installation/finish_client.rb

Overview

Abstract class that simplify writting finish clients for installation. It provides single entry point and abstract methods, that all finish clients need to implement.

Inst-Finish Scripts

About

They are called by the inst_finish.ycp installation client at the end of the first stage installation.

Part of these clients are called with SCR connected to inst-sys, the others are called after SCR gets switched to the installed system (chrooted).

Script inst_finish.ycp contains several stages, every has

  • label - visible in the writing progress

  • steps - list of additional inst_finish scripts that are called ("bingo" -> "bingo_finish.ycp") Important script is "switch_scr", after that call, SCR is connected to the just installed system.

Finish Scripts

Every single finish script is a non-interactive script (write-only). It's basically called twice:

  • At first "Info" returns in which modes "Write" should be called

  • Then "Write" should be called to do the job

Examples:

how to run client

require "installation/example_finish"
::Installation::ExampleFinish.run

See Also:

  • example client in installation clone_finish.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.runObject

Entry point for calling client. The only part needed in client rb file.

Returns:

  • response from abstract methods


44
45
46
# File 'library/general/src/lib/installation/finish_client.rb', line 44

def self.run
  new.run
end

Instance Method Details

#infoObject (protected)

Adapt the metadata for inst_finish API


91
92
93
94
95
96
97
# File 'library/general/src/lib/installation/finish_client.rb', line 91

def info
  {
    "when"  => modes,
    "steps" => steps,
    "title" => title
  }
end

#modesArray<Symbol>? (protected)

Restrict in which modes it should run.

Returns:

  • (Array<Symbol>, nil)

    Valid values are :autoinst, :autoupg, :installation, :live_installation, and :update. NOTE that these values are NOT consistent with the names used in Mode. By default it returns nil, meaning to run always.


76
77
78
# File 'library/general/src/lib/installation/finish_client.rb', line 76

def modes
  nil
end

#runObject

Dispatches to abstract method based on passed arguments to client


49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'library/general/src/lib/installation/finish_client.rb', line 49

def run
  func = Yast::WFM.Args.first
  log.info "Called #{self.class}.run with #{func}"

  case func
  when "Info"
    info
  when "Write"
    write
  else
    raise ArgumentError, "Invalid action for proposal '#{func.inspect}'"
  end
end

#stepsInteger (protected)

Returns the number of client steps.

Returns:

  • (Integer)

    the number of client steps.


81
82
83
# File 'library/general/src/lib/installation/finish_client.rb', line 81

def steps
  1
end

#titleString (protected)

Returns a title used to display to the user what is happening.

Returns:

  • (String)

    a title used to display to the user what is happening.

Raises:

  • (NotImplementedError)

86
87
88
# File 'library/general/src/lib/installation/finish_client.rb', line 86

def title
  raise NotImplementedError, "Calling abstract method 'title'"
end

#writeObject (protected)

Write configuration.

Raises:

  • (NotImplementedError)

66
67
68
# File 'library/general/src/lib/installation/finish_client.rb', line 66

def write
  raise NotImplementedError, "Calling abstract method 'write'"
end