Class: VagrantArtixHost::Util::Platform

Inherits:
Object
  • Object
show all
Defined in:
lib/util/platform.rb

Class Method Summary collapse

Class Method Details

.dinit?Boolean

dinit is in use

Returns:

  • (Boolean)


43
44
45
46
47
48
49
50
51
52
# File 'lib/util/platform.rb', line 43

def dinit?
  if !defined?(@_dinit)
    if Util::Which.which('dinitctl')
      @_dinit = true
    else
      @_dinit = false
    end
  end
  @_dinit
end

.openrc?Boolean

OpenRC is in use

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
18
# File 'lib/util/platform.rb', line 9

def openrc?
  if !defined?(@_openrc)
    if Vagrant::Util::Which.which('rc-update')
      @_openrc = true
    else
      @_openrc = false
    end
  end
  @_openrc
end

.runit?Boolean

Runit is in use

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
29
# File 'lib/util/platform.rb', line 21

def runit?
  if !defined?(@_runit)
    result = Vagrant::Util::Subprocess.execute('ps', '-o', 'comm=', '1')
    @_runit = result.stdout.chomp == 'runit-init'
  else
    @_runit = false
  end
  @_runit
end

.s6?Boolean

S6 is in use

Returns:

  • (Boolean)


32
33
34
35
36
37
38
39
40
# File 'lib/util/platform.rb', line 32

def s6?
  if !defined?(@_s6)
    result = Vagrant::Util::Subprocess.execute('ps', '-o', 'comm=', '1')
    @_s6 = result.stdout.chomp == 's6-svscan'
  else
    @_s6 = false
  end
  @_s6
end