Sha256: 6f3f0350e721a2847517dc3c950ce6d0e656b0c4d08ac01b438e6871f599ea8b

Contents?: true

Size: 987 Bytes

Versions: 39

Compression:

Stored size: 987 Bytes

Contents

module SpecInfra
  module Command
    class Debian < Linux
      def check_enabled(service, level=3)
        # Until everything uses Upstart, this needs an OR.
        "ls /etc/rc#{level}.d/ | grep -- '^S..#{escape(service)}' || grep 'start on' /etc/init/#{escape(service)}.conf"
      end

      def check_installed(package, version=nil)
        escaped_package = escape(package)
        if version
          cmd = "dpkg-query -f '${Status} ${Version}' -W #{escaped_package} | grep -E '^install ok installed #{escape(version)}$'"
        else
          cmd = "dpkg-query -f '${Status}' -W #{escaped_package} | grep '^install ok installed$'"
        end
        cmd
      end

      alias :check_installed_by_apt :check_installed

      def install(package)
        "apt-get -y install #{package}"
      end

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

    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
specinfra-1.2.1 lib/specinfra/command/debian.rb
specinfra-1.2.0 lib/specinfra/command/debian.rb
specinfra-1.1.1 lib/specinfra/command/debian.rb
specinfra-1.1.0 lib/specinfra/command/debian.rb
specinfra-1.0.5 lib/specinfra/command/debian.rb
specinfra-1.0.4 lib/specinfra/command/debian.rb
specinfra-1.0.3 lib/specinfra/command/debian.rb
specinfra-1.0.2 lib/specinfra/command/debian.rb
specinfra-1.0.1 lib/specinfra/command/debian.rb
specinfra-1.0.0 lib/specinfra/command/debian.rb
specinfra-0.8.0 lib/specinfra/command/debian.rb
specinfra-0.7.3 lib/specinfra/command/debian.rb
specinfra-0.7.2 lib/specinfra/command/debian.rb
specinfra-0.7.1 lib/specinfra/command/debian.rb
specinfra-0.7.0 lib/specinfra/command/debian.rb
specinfra-0.6.1 lib/specinfra/command/debian.rb
specinfra-0.6.0 lib/specinfra/command/debian.rb
specinfra-0.5.9 lib/specinfra/command/debian.rb
specinfra-0.5.8 lib/specinfra/command/debian.rb
specinfra-0.5.7 lib/specinfra/command/debian.rb