-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
247 additions
and
90 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
# Specific YaST code lives within this module. | ||
module Yast2 | ||
module DInstaller | ||
end | ||
|
||
require "yast2/installer" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
# Namespace for DBus API | ||
module DInstaller | ||
module DBus | ||
end | ||
end | ||
|
||
require "dinstaller/dbus/manager" | ||
require "dinstaller/dbus/language" | ||
require "dinstaller/dbus/software" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Copyright (c) [2022] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require "dbus" | ||
|
||
module DInstaller | ||
module DBus | ||
# YaST D-Bus object (/org/opensuse/YaST/Installer1) | ||
# | ||
# @see https://rubygems.org/gems/ruby-dbus | ||
class Language < ::DBus::Object | ||
PATH = "/org/opensuse/DInstaller/Language1".freeze | ||
private_constant :PATH | ||
|
||
LANGUAGE_INTERFACE = "org.opensuse.DInstaller.Language1".freeze | ||
private_constant :LANGUAGE_INTERFACE | ||
|
||
# @param installer [Yast2::Installer] YaST installer instance | ||
def initialize(installer, logger) | ||
@installer = installer | ||
@logger = logger | ||
|
||
super(PATH) | ||
end | ||
|
||
dbus_interface LANGUAGE_INTERFACE do | ||
dbus_reader :available_languages, "a(ssa{sv})" | ||
attr_writer :available_languages | ||
dbus_watcher :available_languages | ||
|
||
dbus_reader :marked_for_install, "as" | ||
|
||
dbus_method :ToInstall, "in LangIDs:as" do |lang_ids| | ||
logger.info "ToInstall #{lang_ids.inspect}" | ||
select_to_install(lang_ids) | ||
|
||
self[DBus::PROPERTY_INTERFACE].PropertiesChanged(LANGUAGE_INTERFACE, {"MarkedForInstall" => lang_ids}, []) | ||
end | ||
end | ||
|
||
def available_languages | ||
@available_languages ||= installer.languages.map { |k,v| [k, v.first, {}] } | ||
end | ||
|
||
def marked_for_install | ||
# TODO: change when installer support multiple target languages | ||
res = [installer.language] | ||
logger.info "MarkedForInstall #{res}" | ||
res | ||
end | ||
|
||
def select_to_install(lang_ids) | ||
# TODO: adapt installer API to allow more languages to install | ||
installer.language = lang_ids.first | ||
end | ||
|
||
private | ||
|
||
attr_reader :installer, :logger | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) [2021] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require "dbus" | ||
|
||
module DInstaller | ||
module DBus | ||
# YaST D-Bus object (/org/opensuse/DInstaller/Manager1) | ||
# | ||
# @see https://rubygems.org/gems/ruby-dbus | ||
class Manager < ::DBus::Object | ||
PATH = "/org/opensuse/DInstaller/Manager1".freeze | ||
private_constant :PATH | ||
|
||
MANAGER_INTERFACE = "org.opensuse.DInstaler.Manager1".freeze | ||
private_constant :MANAGER_INTERFACE | ||
|
||
attr_reader :installer, :logger | ||
|
||
# @param installer [Yast2::Installer] YaST installer instance | ||
# @param args [Array<Object>] ::DBus::Object arguments | ||
def initialize(installer, logger) | ||
@installer = installer | ||
@logger = logger | ||
|
||
# @available_base_products = installer.products | ||
|
||
super(PATH) | ||
end | ||
|
||
dbus_interface MANAGER_INTERFACE do | ||
dbus_method :probe, "out result:u" do | ||
# TODO | ||
0 | ||
end | ||
|
||
dbus_method :commit, "out result:u" do | ||
# TODO | ||
0 | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.