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.82.25 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.24 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.23 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.22 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.21 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.20 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.19 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.18 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.17 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.16 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.15 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.14 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.13 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.12 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.11 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.10 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.9 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.8 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.7 lib/specinfra/command/debian/base/package.rb
specinfra-2.82.6 lib/specinfra/command/debian/base/package.rb