Sha256: 44d6dec4903017e4d1c705cff37d306f36893e32ad910cc1481a7891447a2c8a

Contents?: true

Size: 1.81 KB

Versions: 40

Compression:

Stored size: 1.81 KB

Contents

module VagrantPlugins
  module GuestALT
    module Cap
      class Flavor
        def self.flavor(machine)
          comm = machine.communicate

          # Read the version file
          if comm.test("test -f /etc/os-release")
            name = nil
            comm.sudo("grep NAME /etc/os-release") do |type, data|
              if type == :stdout
                name = data.split("=")[1].gsub!(/\A"|"\Z/, '')
              end
            end

            if !name.nil? and name == "Sisyphus"
              return :alt
            end

            version = nil
            comm.sudo("grep VERSION_ID /etc/os-release") do |type, data|
              if type == :stdout
                verstr = data.split("=")[1]
                if verstr == "p8"
                  version = 8
                elsif verstr =~ /^[[\d]]/
                  version = verstr.chomp.to_i
                  subversion = verstr.chomp.split(".")[1].to_i
                  if subversion > 90
                    version += 1
                  end
                end
              end
            end

            if version.nil? or version == 0
              return :alt
            else
              return :"alt_#{version}"
            end
          else
            output = ""
            comm.sudo("cat /etc/altlinux-release") do |_, data|
              output = data
            end

            # Detect various flavors we care about
            if output =~ /(ALT SP|ALT Education|ALT Workstation|ALT Workstation K|ALT Linux starter kit)\s*8(\.[1-9])?( .+)?/i
              return :alt_8
            elsif output =~ /ALT\s+8(\.[1-9])?( .+)?\s.+/i
              return :alt_8
            elsif output =~ /ALT Linux p8( .+)?/i
              return :alt_8
            else
              return :alt
            end
          end
        end
      end
    end
  end
end

Version data entries

40 entries across 36 versions & 5 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/guests/alt/cap/flavor.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.3.3.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.3.2.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.19.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.18.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.16.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.14.0 plugins/guests/alt/cap/flavor.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.10.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.9.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.8.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.7.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.6.2 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.6.1 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.6.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.5.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.4.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.3.0 plugins/guests/alt/cap/flavor.rb
vagrant-unbundled-2.2.2.0 plugins/guests/alt/cap/flavor.rb