Skip to content

Commit

Permalink
Initialize packager
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Aug 18, 2016
1 parent 5b57673 commit 1d58b8b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/lib/installation/clients/inst_update_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class InstUpdateInstaller
REGISTRATION_DATA_PATH = "/var/lib/YaST2/inst_update_installer.yaml".freeze

Yast.import "Pkg"
Yast.import "Packages"
Yast.import "PackageCallbacks"
Yast.import "Language"
Yast.import "GetInstArgs"
Yast.import "Directory"
Yast.import "Installation"
Expand All @@ -53,6 +56,9 @@ def main

log.info("Trying installer update")

# prepare for downloading packages
initialize_packager

if update_installer
::FileUtils.touch(update_flag_file) # Indicates that the installer was updated.
Installation.restart!
Expand Down Expand Up @@ -208,6 +214,8 @@ def registration_url
def registration_url_from_profile
return nil unless Mode.auto

# TODO: download the AutoYaST profile first
# see ../../lib/transfer/file_from_url.rb#L89
profile = Yast::Profile.current
profile_url = profile.fetch("suse_register", {})["reg_server"]
get_url_from(profile_url)
Expand Down Expand Up @@ -434,5 +442,17 @@ def import_registration_ayconfig
Yast::Profile.current.fetch("suse_register", {})
)
end

# Initialize the package management so we can download the updates from
# the update repository.
def initialize_packager
log.info "Initializing the package management"
# initialize package callbacks to show a progress while downloading files
PackageCallbacks.InitPackageCallbacks
# make sure libzypp reports errors using the current locale
Pkg.SetTextLocale(Language.language)
# load the GPG keys from inst-sys
Packages.ImportGPGKeys
end
end
end
3 changes: 3 additions & 0 deletions src/lib/installation/update_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ def apply(mount_path = Pathname("/mounts"))
#
# Release the repository
def cleanup
Yast::Pkg.SourceRelease(repo_id)
Yast::Pkg.SourceDelete(repo_id)
# make sure it's also removed from disk
Yast::Pkg.SourceSaveAll
end

# Determine whether the repository is empty or not
Expand Down

0 comments on commit 1d58b8b

Please sign in to comment.