Skip to content

Commit

Permalink
Copy proxy config to the target system
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Aug 21, 2023
1 parent 40e46fa commit 250850c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions service/lib/agama/network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
require "yast"
require "yast2/systemd/service"
require "y2network/proposal_settings"
require "agama/proxy_setup"

Yast.import "Installation"

Expand All @@ -41,6 +42,8 @@ def initialize(logger)
def install
copy_files
enable_service

ProxySetup.instance.install
end

private
Expand Down
18 changes: 18 additions & 0 deletions service/lib/agama/proxy_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class ProxySetup

CMDLINE_PATH = "/proc/cmdline"
CMDLINE_MENU_CONF = "/etc/cmdline-menu.conf"
PACKAGES = ["microos-tools"].freeze
CONFIG_PATH = "/etc/sysconfig/proxy"

# @return [URI::Generic]
attr_accessor :proxy
Expand Down Expand Up @@ -105,5 +107,21 @@ def write

Proxy.Write
end

def install
return unless proxy

copy_files
add_packages
end

def add_packages
log.info "Selecting these packages for installation: #{PACKAGES}"
Yast::PackagesProposal.SetResolvables(PROPOSAL_ID, :package, PACKAGES)
end

def copy_files
FileUtils.cp(CONFIG_PATH, File.join(Yast::Installation.destdir, CONFIG_PATH))
end
end
end

0 comments on commit 250850c

Please sign in to comment.