Sha256: 1748222035a992dbbf43bbb109777cbfa3c079057a99780f134ec8e0cb881353

Contents?: true

Size: 961 Bytes

Versions: 65

Compression:

Stored size: 961 Bytes

Contents

class Specinfra::Helper::DetectOs::Debian < Specinfra::Helper::DetectOs
  def self.detect
    if run_command('ls /etc/debian_version').success?
      distro  = nil
      release = nil
      lsb_release = run_command("lsb_release -ir")
      if lsb_release.success?
        lsb_release.stdout.each_line do |line|
          distro  = line.split(':').last.strip if line =~ /^Distributor ID:/
          release = line.split(':').last.strip if line =~ /^Release:/
        end
      else
        lsb_release = run_command("cat /etc/lsb-release")
        if lsb_release.success?
          lsb_release.stdout.each_line do |line|
            distro  = line.split('=').last.strip if line =~ /^DISTRIB_ID=/
            release = line.split('=').last.strip if line =~ /^DISTRIB_RELEASE=/
          end
        end
      end
      distro ||= 'debian'
      release ||= nil
      { :family => distro.gsub(/[^[:alnum:]]/, '').downcase, :release => release }
    end
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
specinfra-2.21.1 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.21.0 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.20.2 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.20.1 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.20.0 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.19.6 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.19.5 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.19.4 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.19.3 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.19.2 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.19.1 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.19.0 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.18.3 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.18.2 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.18.1 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.18.0 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.17.1 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.17.0 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.16.0 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.15.2 lib/specinfra/helper/detect_os/debian.rb