Skip to content
Permalink
Browse files

Use the license api for skipping the eula_dialog if license is alread…

…y accepted
  • Loading branch information...
teclator authored and imobachgs committed Mar 29, 2018
1 parent 5484baa commit e3b6e0593b730c8308764f2d44b1f5313c04b9a7
Showing with 19 additions and 1 deletion.
  1. +19 −1 src/lib/registration/ui/addon_eula_dialog.rb
@@ -3,6 +3,7 @@
require "registration/eula_downloader"
require "registration/eula_reader"
require "registration/helpers"
require "y2packager/license_store"

module Registration
module UI
@@ -127,9 +128,13 @@ def accept_eula(addon)
Dir.mktmpdir("extension-eula-") do |tmpdir|
return :back unless download_eula(addon, tmpdir)
eula_reader = EulaReader.new(tmpdir)
license = license(addon, eula_reader)
return :accepted if license.accepted?

setup_eula_dialog(addon, eula_reader, tmpdir)
run_eula_dialog(eula_reader)
ret = run_eula_dialog(eula_reader)
license.accept! if ret == :accepted
ret
end
ensure
Yast::ProductLicense.CleanUp()
@@ -140,6 +145,19 @@ def accept_eula(addon)
def display_optional_info(info_file)
Yast::InstShowInfo.show_info_txt(info_file) if File.exist?(info_file)
end

def license_already_accepted?(addon, eula_reader)
license(addon, eula_reader).accepted?
end

def license(addon, eula_reader)
license_file = eula_reader.licenses[Y2Packager::License::DEFAULT_LANG]
return false unless license_file
content = Yast::SCR.Read(path(".target.string"), license_file)

license = Y2Packager::License.new(content: content)
Y2Packager::LicenseStore.instance.add_license_for(addon.identifier, license)
end
end
end
end

0 comments on commit e3b6e05

Please sign in to comment.
You can’t perform that action at this time.