-
Notifications
You must be signed in to change notification settings - Fork 10
/
add-on.rb
97 lines (80 loc) · 2.43 KB
/
add-on.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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
# File: clients/add-on.ycp
# Package: yast2-installation
# Summary: Install an add-on product
# Authors: Jiri Srain <jsrain@suse.de>
#
module Yast
class AddOnClient < Client
def main
Yast.import "Pkg"
Yast.import "UI"
textdomain "add-on"
Yast.import "AddOnProduct"
Yast.import "Confirm"
Yast.import "PackageLock"
Yast.import "PackageCallbacks"
Yast.import "Report"
Yast.import "Wizard"
Yast.import "GetInstArgs"
Yast.import "Mode"
Yast.import "CommandLine"
Yast.import "Directory"
Yast.include self, "add-on/add-on-workflow.rb"
CommandLine.Run(
"id" => "add_on",
# Command line help text for the repository module, %1 is "zypper"
"help" => format(
_(
"Add On Management - This module does not support the command line " \
"interface, use '%{zypper}' instead for adding a new repository or " \
"'%{SUSEConnect}' to register a new add-on."
),
zypper: "zypper", SUSEConnect: "SUSEConnect"
),
"guihandler" => fun_ref(method(:run_GUI), "symbol ()")
)
end
def run_GUI
Wizard.CreateDialog
Wizard.SetContents(
# dialog caption
_("Add-On Products"),
# busy message (dialog)
VBox(Label(_("Initializing..."))),
# help
_("<p>Initializing add-on products...</p>"),
false,
false
)
Wizard.SetDesktopTitleAndIcon("org.opensuse.yast.AddOn")
Wizard.DisableBackButton
Wizard.DisableAbortButton
Wizard.DisableNextButton
# --> Initialization start
# check whether running as root
# and having the packager for ourselves
if !Confirm.MustBeRoot || !PackageLock.Check
UI.CloseDialog
return :abort
end
# initialize target to import all trusted keys (#165849)
Pkg.TargetInitialize("/")
Pkg.TargetLoad
PackageCallbacks.InitPackageCallbacks
# Initialize current sources
Read()
# <-- Initialization finish
Wizard.EnableAbortButton
Wizard.EnableNextButton
ret = RunAddOnsOverviewDialog()
Pkg.SourceSaveAll if @ret == :next
# bugzilla #293428
# Release all sources before adding a new one
# because of CD/DVD + url cd://
Pkg.SourceReleaseAll
UI.CloseDialog
ret
end
end
end
Yast::AddOnClient.new.main