Skip to content

Commit

Permalink
Self update refactoring (#422)
Browse files Browse the repository at this point in the history
* Initialize packager

* Make the self update actually work

* Repository cleanup

* Better package manager init

* Show progress

* Rubocop fixes

* Updated comments

* Let the UI to calculate the percentage

* Remove fixes for self_update not needed anymore.

* Better self update URL evaluation

- The boot option has the highest priority now
- Always confirm the SLP service
- In AutoYaST: use SLP only when enabled in the profile
- In AutoYaST: ask if more then one SLP service is found

* Adapt the tests

* Display a global progress for self update

* Move progress to separate methods

* Added "apply" progress step

* Updated the self update documentation

* Fixed indentation

* Mock Pkg in inst_finish_test.rb

Do not load the installed packages from the real system in the tests.

* Mock Pkg, improve test

* Added unit tests for the new code

test package management init and displaying the progress

* Added comments

* [WIP] Fetch profile from update installer (#424)

* Fetch profile from update installer directly.

* Try to not block AutoYast while fetching the profile.

* Splited fetch profile in smallest methods and added documentation.

* Avoid the block of AutoYast by ProfileLocation.

* Code review fixes

* Changes

* initialize libzypp target in self update

* Fixed finishing the packager, improved selfupdate=0

* Update test

* Remove Report module setup, not needed anymore

See https://github.com/yast/yast-yast2/pull/492/files

* Code review updates

* Update the tests

* Revert "Don't ask twice about multipath bsc#989770"

* This reverts commit 262eeaa.
* After moving the self-update to the beginning of the installation
  that change is not needed anymore.

* Revert yast2-storage 3.1.97 dependency

* Improve libzypp initialization

* Removed return value - we do not check errors (yet)

* Bump version.

* Add a separator to changes

* Removed obsolete comment
  • Loading branch information
lslezak committed Aug 26, 2016
1 parent 4bf104b commit 943abe4
Show file tree
Hide file tree
Showing 14 changed files with 496 additions and 208 deletions.
41 changes: 33 additions & 8 deletions doc/SELF_UPDATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ These are the basic steps performed by YaST in order to perform the update:
3. The update will be applied to the installation system.
4. YaST will be restarted and the installation will be resumed.

### Language Selection

The self update step is executed before selecting the language
(`inst_complex_welcome` client). That means the self update progress and
the errors which happens during the self update process are by default displayed
in English.

To use another language also for the self update press `F2` in the DVD boot menu
and select the language from the list. Or use the `language` boot option, e.g.
`language=de_DE`.


## Update Format

YaST will use RPM packages stored in a rpm-md repository, although they are
Expand All @@ -46,11 +58,15 @@ The URL of the update repository is evaluated in this order:
```
3. Registration server (SCC/SMT), not available in openSUSE. The URL of the
registration server which should be used is determined via:
1. AutoYaST profile ([reg_server element](https://www.suse.com/documentation/sles-12/singlehtml/book_autoyast/book_autoyast.html#CreateProfile.Register)).
2. The `regurl` boot parameter
1. The `regurl` boot parameter
2. AutoYaST profile ([reg_server element](https://www.suse.com/documentation/sles-12/singlehtml/book_autoyast/book_autoyast.html#CreateProfile.Register)).
3. SLP lookup (this behavior applies to regular and AutoYaST installations):
* If one server is found, it will be used automatically.
* If more than one server is found, it will ask the user to choose one.
* If at least one server is found it will ask the user to choose one.
* In AutoYaST mode SLP is skipped unless enabled in the profile in the
registration section (see [documentation](https://www.suse.com/documentation/sles-12/singlehtml/book_autoyast/book_autoyast.html#idm140139881100304)).
AutoYaST expects that only one server is reported by SLP, if more
servers are found it is considered as an error and user interaction is
required just like in manual installation.
4. Default SUSE Customer Center API (`https://scc.suse.com/`).
4. Hard-coded in the `control.xml` file on the installation medium (thus it
depends on the base product):
Expand Down Expand Up @@ -93,6 +109,10 @@ Updates signatures will be checked by libzypp. If the signature is not
correct (or is missing), the user will be asked whether she/he wants to apply
the update (although it's a security risk).

When using SLP discovery a popup is displayed to choose the server to use.
SLP by default does not use any authentication, everybody on the local network
can announce a registration server.

## Self-update and User Updates

Changes introduced by the user via Driver Updates (`dud` boot option) will take
Expand All @@ -107,10 +127,15 @@ Any client called before the self update step is responsible to remember its sta
needed) and automatically going to the next dialog after the YaST restart.
Once the self update step is reached again it will remove the restarting flag.

Currently there is no API available for remembering the client states. The easiest
way is to store the configuration into an YAML file and load it when restarting the
installer. See the [example](https://github.com/yast/yast-installation/pull/367/files#diff-4c91d6424e08c9bef9237f7d959fc0c2R48)
in the `inst_complex_welcome` client.
The self update step is called very early in the workflow, for the self update
step only configured network is needed. That is configured either by `linuxrc`
or by the `setup_dhcp` YaST client which does not need to remember any state.

## Supported URL Schemes

Currently only HTTP/HTTPS and FTP URL schemes are supported for downloading
the updates. Some additional schemes might work but are not tested and therefore
not supported.

## Error handling

Expand Down
14 changes: 14 additions & 0 deletions package/yast2-installation.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
-------------------------------------------------------------------
Thu Aug 25 14:23:20 UTC 2016 - lslezak@suse.cz

- Move the installer self update step earlier in the workflow
so the user entered values are not lost after restart and avoid
repeating some steps again (bsc#985055)
- This also fixes losing some values due to restaring YaST (bsc#993690),
(bsc#992608)
- Improved the self update URL handling - the boot parameter has
the highest priority, always ask user when a SLP service is found,
in AutoYaST mode SLP needs to be enabled in the profile
- Display progress when downloading and applying the updates
- 3.1.213

-------------------------------------------------------------------
Wed Aug 25 12:51:45 UTC 2016 - cwh@suse.com

Expand Down
6 changes: 3 additions & 3 deletions package/yast2-installation.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-installation
Version: 3.1.212
Version: 3.1.213
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down Expand Up @@ -63,8 +63,8 @@ Conflicts: yast2-mouse < 2.18.0
# Lazy loading in ProductLicense
Requires: yast2-packager >= 3.1.113

# Yast::Storage.multipath_off?
Requires: yast2-storage >= 3.1.97
# Storage::GetDetectedDiskPaths
Requires: yast2-storage >= 2.24.1

# use in startup scripts
Requires: initviocons
Expand Down
35 changes: 0 additions & 35 deletions src/lib/installation/clients/inst_complex_welcome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ def main
@license_id = Ops.get(Pkg.SourceGetCurrent(true), 0, 0)

# ------------------------------------- main part of the client -----------
if Installation.restarting? && data_stored?
apply_data
return :next
end

@argmap = GetInstArgs.argmap

Expand Down Expand Up @@ -127,8 +123,6 @@ def event_loop

setup_final_choice

store_data

return :next
when :show_fulscreen_license
UI.OpenDialog(all_licenses_dialog)
Expand Down Expand Up @@ -383,35 +377,6 @@ def setup_final_choice
log.info "Language: '#{@language}', system encoding '#{WFM.GetEncoding}'"
end

DATA_PATH = "/var/lib/YaST2/complex_welcome_store.yaml".freeze

def data_stored?
::File.exist?(DATA_PATH)
end

def store_data
data = {
"language" => @language,
"keyboard" => @keyboard,
"license_accepted" => InstData.product_license_accepted
}

File.write(DATA_PATH, data.to_yaml)
end

def apply_data
data = YAML.load(File.read(DATA_PATH))
@language = data["language"]
@keyboard = data["keyboard"]
InstData.product_license_accepted = data["license_accepted"]
ProductLicense.info_seen!(@license_id)

change_language
setup_final_choice

::FileUtils.rm_rf(DATA_PATH)
end

def text_mode?
return @text_mode unless @text_mode.nil?

Expand Down
2 changes: 0 additions & 2 deletions src/lib/installation/clients/inst_disks_activate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ def main
@have_zfcp = false
@want_fcoe = false

return :next if Installation.restarting?

if Arch.s390
# popup label
UI.OpenDialog(Label(_("Detecting Available Controllers")))
Expand Down
32 changes: 0 additions & 32 deletions src/lib/installation/clients/inst_system_analysis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,15 @@
# Lukas Ocilka <locilka@suse.cz>

require "yast"
require "fileutils"

module Yast
class InstSystemAnalysisClient < Client
include Yast::Logger

def main
Yast.import "UI"

textdomain "installation"

Yast.import "Arch"
Yast.import "Directory"
Yast.import "GetInstArgs"
Yast.import "Hotplug"
Yast.import "InstData"
Expand All @@ -60,8 +56,6 @@ def main
Yast.include self, "packager/storage_include.rb"
Yast.include self, "packager/load_release_notes.rb"

@multipath_off_file = File.join(Directory.vardir, "multipath_off")

if Mode.autoupgrade
Report.Import(

Expand Down Expand Up @@ -150,9 +144,6 @@ def main
_("YaST is probing computer hardware and installed systems now.")
)

# bug#989770
Storage.SetMultipathStartup(false) if persisted_multipath_off?

actions_functions.each do |run_function|
Progress.NextStage
# Bugzilla #298049
Expand All @@ -174,12 +165,6 @@ def main
end
Installation.probing_done = true

# bug#989770
if Storage.multipath_off?
log.info "The user decided to not activate multipath"
persist_multipath_off
end

# the last step is hidden
return :abort if ProductProfile.CheckCompliance(nil) == false

Expand Down Expand Up @@ -370,22 +355,5 @@ def FilesFromOlderSystems

true
end

protected

# Sets a mark for the installer (in case it's executed again due to
# self-update) to disable multipath without asking the user
def persist_multipath_off
log.info "Multipath activation pop-up will be skipped if installer restarts"
::FileUtils.touch(@multipath_off_file)
end

# Checks if #persist_multipath_off was called in the previous execution of
# the installer. @see #persist_multipath_off
#
# @return [Boolean]
def persisted_multipath_off?
::File.exist?(@multipath_off_file)
end
end
end
Loading

0 comments on commit 943abe4

Please sign in to comment.