Skip to content

Commit

Permalink
Make install method public
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Aug 22, 2023
1 parent 3493147 commit 4791a4f
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions service/lib/agama/proxy_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

require "yast"
require "uri"
require "fileutils"

module Agama
# This class is responsible of parsing the proxy url from the kernel cmdline or configured
Expand All @@ -35,20 +36,31 @@ class ProxySetup
CMDLINE_MENU_CONF = "/etc/cmdline-menu.conf"
PACKAGES = ["microos-tools"].freeze
CONFIG_PATH = "/etc/sysconfig/proxy"
PROPOSAL_ID = "network_proposal"

# @return [URI::Generic]
attr_accessor :proxy

# Constructor
def initialize
Yast.import "Proxy"
Yast.import "Installation"
Yast.import "PackagesProposal"
end

def run
read
write
end

def install
Proxy.Read
return unless Proxy.enabled

copy_files
add_packages
end

private

def read
Expand Down Expand Up @@ -108,22 +120,14 @@ def write
Proxy.Write
end

def install
Proxy.Read
return unless Proxy.enabled

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
log.info "Copying proxy configuration to the target system"
FileUtils.cp(CONFIG_PATH, File.join(Yast::Installation.destdir, CONFIG_PATH))
::FileUtils.cp(CONFIG_PATH, File.join(Yast::Installation.destdir, CONFIG_PATH))
end
end
end

0 comments on commit 4791a4f

Please sign in to comment.