Sha256: 8cdaf846973d569722cee06737a5e4247bc1d6b0131c24e8ab28d174dc693930

Contents?: true

Size: 1.15 KB

Versions: 95

Compression:

Stored size: 1.15 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 #{Regexp.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 #{escape(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

95 entries across 95 versions & 1 rubygems

Version Path
specinfra-2.91.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.90.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.90.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.89.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.88.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.88.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.88.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.87.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.87.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.87.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.86.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.85.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.85.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.84.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.84.0 lib/specinfra/command/debian/base/package.rb
specinfra-2.83.4 lib/specinfra/command/debian/base/package.rb
specinfra-2.83.3 lib/specinfra/command/debian/base/package.rb
specinfra-2.83.2 lib/specinfra/command/debian/base/package.rb
specinfra-2.83.1 lib/specinfra/command/debian/base/package.rb
specinfra-2.83.0 lib/specinfra/command/debian/base/package.rb