class AutomateIt::PackageManager::APT

PackageManager::APT

The APT driver for the PackageManager provides a way to manage software packages on Debian-style systems using apt-get and dpkg.

Public Instance Methods

install(*packages) click to toggle source

See AutomateIt::PackageManager#install

# File lib/automateit/package_manager/apt.rb, line 13
def install(*packages)
  return _install_helper(*packages) do |list, opts|
    # apt-get options:
    # -y : yes to all queries
    # -q : no interactive progress bars
    cmd = "export DEBIAN_FRONTEND=noninteractive; apt-get"
    cmd << " -t #{opts[:backports]}" if opts[:backports]
    cmd << " install -y -q "+list.join(" ")+" < /dev/null"
    cmd << " > /dev/null" if opts[:quiet]
    cmd << " 2>&1"

    interpreter.sh(cmd)
  end
end