Class: Yast::PkgFinishClient

Inherits:
Installation::FinishClient
  • Object
show all
Includes:
I18n, Logger
Defined in:
src/lib/packager/clients/pkg_finish.rb,
src/lib/packager/clients/pkg_finish.rb

Overview

Finish client for packager

Constant Summary collapse

REPOS_DIR =

Path to libzypp repositories

"/etc/zypp/repos.d".freeze
FAILED_PKGS_PATH =

Path to failed_packages file

"/var/lib/YaST2/failed_packages".freeze
TAR_CMD =

Command to create a tar.gz to back-up old repositories

"/usr/bin/mkdir -p '%<target>s' && cd '%<target>s' "\
"&& /bin/tar -czf '%<archive>s' '%<source>s'".freeze
BACKUP_TIMESTAMP_FORMAT =

Format of the timestamp to be used as repositories backup

"%Y%m%d-%H%M%S".freeze

Instance Method Summary collapse

Constructor Details

#initializePkgFinishClient

Constructor


37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'src/lib/packager/clients/pkg_finish.rb', line 37

def initialize
  textdomain "packager"

  Yast.import "Pkg"
  Yast.import "Installation"
  Yast.import "Mode"
  Yast.import "Stage"
  Yast.import "String"
  Yast.import "FileUtils"
  Yast.import "Packages"
  Yast.import "Directory"
  Yast.import "ProductFeatures"
end

Instance Method Details

#modesObject

See Also:

  • ::Installation::FinishClient#modes

52
53
54
# File 'src/lib/packager/clients/pkg_finish.rb', line 52

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

#titleObject

See Also:

  • ::Installation::FinishClient#title

57
58
59
# File 'src/lib/packager/clients/pkg_finish.rb', line 57

def title
  _("Saving the software manager configuration...")
end

#writeObject

See Also:

  • ::Installation::FinishClient#write

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
91
92
93
94
95
96
97
98
99
100
# File 'src/lib/packager/clients/pkg_finish.rb', line 62

def write
  # Remove (backup) all sources not used during the update
  # BNC #556469: Backup and remove all the old repositories before any Pkg::SourceSaveAll call
  backup_all_target_sources if Stage.initial && Mode.update

  # See bnc #384827, #381360
  if Mode.update
    log.info("Adding default repositories")
    WFM.call("inst_extrasources")
  end

  # If repositories weren't load during installation (for example, in openSUSE
  # if online repositories were not enabled), resolvables should be loaded now.
  Pkg.SourceLoad
  disable_local_repos

  # save all repositories and finish target
  Pkg.SourceSaveAll
  Pkg.TargetFinish

  # save repository metadata cache to the installed system
  # (needs to be done _after_ saving repositories, see bnc#700881)
  Pkg.SourceCacheCopyTo(Installation.destdir)

  # Patching /etc/zypp/zypp.conf in order not to install
  # recommended packages, doc-packages,...
  # (needed for products like CASP)
  if ProductFeatures.GetBooleanFeature("software", "minimalistic_libzypp_config")
    set_minimalistic_libzypp_conf
  end

  # copy list of failed packages to installed system
  if File.exist?(FAILED_PKGS_PATH)
    ::FileUtils.cp(FAILED_PKGS_PATH, File.join(Installation.destdir, FAILED_PKGS_PATH),
      preserve: true)
  end

  nil
end