Class: Yast::DeployImageAutoClient

Inherits:
Installation::AutoClient
  • Object
show all
Includes:
Logger
Defined in:
src/lib/installation/clients/deploy_image_auto.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDeployImageAutoClient

Returns a new instance of DeployImageAutoClient.



34
35
36
37
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 34

def initialize
  super
  textdomain "installation"
end

Class Attribute Details

.modifiedObject

Returns the value of attribute modified.



193
194
195
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 193

def modified
  @modified
end

Instance Method Details

#changeObject



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 82

def change
  # Change configuration
  # return symbol (i.e. `finish || `accept || `next || `cancel || `abort)
  Wizard.CreateDialog
  Wizard.SetContentsButtons(
    # TRANSLATORS: dialog caption
    _("Installation from Images"),
    HBox(
      HStretch(),
      VBox(
        Frame(
          _("Installation from Images"),
          VBox(
            Label(
              _(
                "Here you can choose to use pre-defined images to speed up RPM installation."
              )
            ),
            RadioButtonGroup(
              Id(:images_rbg),
              MarginBox(
                2,
                1,
                VBox(
                  Left(
                    RadioButton(
                      Id(:inst_from_images),
                      Opt(:notify),
                      _("&Install from Images"),
                      Installation.image_installation == true
                    )
                  ),
                  VSpacing(0.5),
                  Left(
                    RadioButton(
                      Id(:dont_inst_from_images),
                      Opt(:notify),
                      _("&Do not Install from Images"),
                      Installation.image_installation != true
                    )
                  )
                )
              )
            )
          )
        )
      ),
      HStretch()
    ),
    # TRANSLATORS: help text
    _(
      "<p><b>Installation from Images</b> is used to speed the installation up.\n" \
      "Images contain compressed snapshots of an installed system matching your\n" \
      "selection of patterns. The rest of the packages which are not contained in the\n" \
      "images will be installed from packages the standard way.</p>\n"
    ),
    Label.BackButton,
    Label.OKButton
  )
  Wizard.SetAbortButton(:abort, Label.CancelButton)
  Wizard.DisableBackButton
  ret = :ok
  loop do
    ret = UI.UserInput
    log.info("ret={ret}")

    if [:ok, :next].include?(ret)
      selected = UI.QueryWidget(:images_rbg, :CurrentButton)
      case selected
      when :inst_from_images
        Installation.image_installation = true
      when :dont_inst_from_images
        Installation.image_installation = false
      end
      log.info("Changed by user, Installation from images will be used: " \
               "#{Installation.image_installation}")
    end
    break if [:ok, :next, :abort].include?(ret)
  end

  Wizard.CloseDialog
  ret
end

#exportObject



170
171
172
173
174
175
176
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 170

def export
  if Installation.image_installation
    { "image_installation" => true }
  else
    {}
  end
end

#import(data) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 47

def import(data)
  ret = false
  if data.key?("image_installation")
    ImageInstallation.changed_by_user = true
    Installation.image_installation = data["image_installation"]
    log.info("Using image_installation: #{Installation.image_installation}")
    ret = true
  end
  ret
end

#modifiedObject



71
72
73
74
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 71

def modified
  self.class.modified = true
  true
end

#modified?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 67

def modified?
  self.class.modified
end

#packagesObject



166
167
168
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 166

def packages
  {}
end

#readObject



187
188
189
190
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 187

def read
  log.info("Read not supported")
  true
end

#resetObject



76
77
78
79
80
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 76

def reset
  ImageInstallation.FreeInternalVariables
  Installation.image_installation = false
  true
end

#runObject



39
40
41
42
43
44
45
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 39

def run
  progress_orig = Yast::Progress.set(false)
  ret = super
  Yast::Progress.set(progress_orig)

  ret
end

#summaryObject



58
59
60
61
62
63
64
65
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 58

def summary
  "<ul><li>" +
    (if Installation.image_installation
       _("Installation from images is: <b>enabled</b>")
     else
       _("Installation from images is: <b>disabled</b>")
     end) + "</li></ul>"
end

#writeObject



178
179
180
181
182
183
184
185
# File 'src/lib/installation/clients/deploy_image_auto.rb', line 178

def write
  log.info("Using images: #{Installation.image_installation}")
  # BNC #442691
  # Calling image_installation only if set to do so...
  WFM.call("inst_prepare_image") if Installation.image_installation

  true
end