19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/aethernal_agent/apt.rb', line 19
def apt_package(options = {})
AethernalAgent.logger.info "Installing apt package(s) with options: #{options}"
action = options[:action]
action = :install if action.nil?
packages = options[:packages]
packages = packages.join(" ") if packages.is_a?(Array)
unless wait_on_apt(180)
self.add_errors("APT could not be started because lock was in use for more than 180 seconds")
end
case action
when :install
print_system("DEBIAN_FRONTEND=noninteractive apt -o DPkg::Options::=--force-confdef install -qy #{packages}")
when :remove
print_system("DEBIAN_FRONTEND=noninteractive apt remove -qy #{packages}")
when :autoremove
print_system("DEBIAN_FRONTEND=noninteractive apt autoremove -qy")
end
end
|