Sha256: dfeb9db1dd8f189e8d1872e82ffad83d52d1b72b690f857d087eec6f6e014c94

Contents?: true

Size: 1.14 KB

Versions: 178

Compression:

Stored size: 1.14 KB

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 -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' #{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

    def remove(package, option='')
      "DEBIAN_FRONTEND='noninteractive' apt-get -y #{option} remove #{package}"
    end
  end
end

Version data entries

178 entries across 178 versions & 3 rubygems

Version Path
specinfra-2.56.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.56.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.55.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.54.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.54.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.54.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.53.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.53.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.52.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.51.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.51.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.51.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.50.4 lib/specinfra/command/debian/base/package.rb
specinfra-2.50.3 lib/specinfra/command/debian/base/package.rb
specinfra-2.50.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.50.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.50.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.49.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.48.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.47.1 lib/specinfra/command/debian/base/package.rb