Sha256: 0364d934542f655eec79eb45c1be93a3f44a3ed6bd22a1bdb26b8c59c828a87b

Contents?: true

Size: 969 Bytes

Versions: 48

Compression:

Stored size: 969 Bytes

Contents

class Specinfra::Command::Debian::Base::Package < Specinfra::Command::Linux::Base::Package
  class << self
    def check_is_installed(package, version=nil)
      escaped_package = escape(package)
      if version
        cmd = "dpkg-query -f '${Status} ${Version}' -W #{escaped_package} | grep -E '^(install|hold) ok installed #{escape(version)}$'"
      else
        cmd = "dpkg-query -f '${Status}' -W #{escaped_package} | grep -E '^(install|hold) ok installed$'"
      end
      cmd
    end

    alias :check_is_installed_by_apt :check_is_installed

    def install(package, version=nil, option='')
      if version
        full_package = "#{package}=#{version}"
      else
        full_package = package
      end
      "DEBIAN_FRONTEND='noninteractive' apt-get -y #{option} install #{full_package}"
    end

    def get_version(package, opts=nil)
      "dpkg-query -f '${Status} ${Version}' -W #{package} | sed -n 's/^install ok installed //p'"
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
specinfra-2.11.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.11.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.10.4 lib/specinfra/command/debian/base/package.rb
specinfra-2.10.3 lib/specinfra/command/debian/base/package.rb
specinfra-2.10.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.10.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.10.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.9.3 lib/specinfra/command/debian/base/package.rb
specinfra-2.9.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.9.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.9.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.8.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.7.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.6.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.5.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.4.5 lib/specinfra/command/debian/base/package.rb
specinfra-2.4.4 lib/specinfra/command/debian/base/package.rb
specinfra-2.4.3 lib/specinfra/command/debian/base/package.rb
specinfra-2.4.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.4.1 lib/specinfra/command/debian/base/package.rb