Sha256: ccf91d514bdc48ca215a41bcc8c6875e6e7c89a72117e6a6644ae037d1720e12

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 Bytes

Contents

module Unix::Pkg
  include Beaker::CommandFactory

  def check_for_package name
    result = exec(Beaker::Command.new("which #{name}"), :acceptable_exit_codes => (0...127))
    result.exit_code == 0
  end

  def install_package name
    if self['platform'] =~ /el-4/
      @logger.debug("Package installation not supported on rhel4")
    elsif self['platform'] =~ /(fedora)|(centos)|(el)/
      execute("yum -y install #{name}")
    elsif self['platform'] =~ /(ubuntu)|(debian)/
      execute("apt-get update")
      execute("apt-get install -y #{name}")
    else
      raise "Package #{name} cannot be installed on #{host}"
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beaker-0.0.0 lib/beaker/host/unix/pkg.rb