-
Notifications
You must be signed in to change notification settings - Fork 8
Code Snippets
Ladislav Slezák edited this page Jun 20, 2018
·
3 revisions
# basic UI initialization, only needed in a plain Ruby file or in an irb session
require "yast"
Yast.ui_component="qt"
Yast.import "UI"
# import the pkg-bindings module
Yast.import "Pkg"
# Optionally initialize the default callbacks which will display
# the progress during repository refresh. Skip this if you do not
# need any UI progress (e.g. in command line) or you want to handle
# the callback by yourself.
Yast.import "PackageCallbacks"
Yast::PackageCallbacks.InitPackageCallbacks
# Initialize the target, you can use Installation.destdir instead
# of the hardcoded "/" path.
Yast::Pkg.TargetInitialize("/")
# Load the installed packages into the pool.
Yast::Pkg.TargetLoad
# Load the repository configuration. Refreshes the repositories if needed.
Yast::Pkg.SourceRestore
# Load the available packages in the repositories to the pool.
Yast::Pkg.SourceLoad
Note: The order is important, the target needs to be initialized first. It contains the trusted GPG keys which are used for metadata verification. If you try initializing the sources first you will get "Unknown/untrusted GPG key" errors.