Sha256: fa9974dbcf7e11913b272fa3c463a75670d02c1d17d88393d9517e148b8ae35d

Contents?: true

Size: 888 Bytes

Versions: 32

Compression:

Stored size: 888 Bytes

Contents

class Specinfra::Helper::DetectOs::Debian < Specinfra::Helper::DetectOs
  def self.detect
    if run_command('ls /etc/debian_version').success?
      lsb_release = run_command("lsb_release -ir")
      if lsb_release.success?
        if lsb_release.stdout =~ /:/
          distro = lsb_release.stdout.split("\n").first.split(':').last
          release = lsb_release.stdout.split("\n").last.split(':').last.strip
        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 if line =~ /^DISTRIB_ID=/
            release = line.split('=').last.strip if line =~ /^DISTRIB_RELEASE=/
          end
        end
      end
      distro ||= 'debian'
      release ||= nil
      { :family => distro.strip.downcase, :release => release }
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
specinfra-2.0.0.beta38 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta37 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta36 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta35 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta34 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta33 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta32 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta31 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta30 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta29 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta28 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta27 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta26 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta25 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta24 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta23 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta22 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta21 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta20 lib/specinfra/helper/detect_os/debian.rb
specinfra-2.0.0.beta19 lib/specinfra/helper/detect_os/debian.rb