Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The right way to do this is to create a custom Fact for your module,

init.rb

and run something like this inside the custom fact ruby to determine whats the init system (remember to confine your Fact to kernel=Linux)

$init = stat /proc/1/exe | grep File: | awk -F'->' {'print $2'}

this will tell you if its systemd or init

You can then pass this Facter value down to your module and let it do its logic from there

The right way to do this is to create a custom Fact for your module,

init.rb

and run something like this inside the custom fact ruby to determine whats the init system (remember to confine your Fact to kernel=Linux)

$init =  stat `stat /proc/1/exe | grep File: | awk -F'->' {'print $2'}$2'}`

this will tell you if its systemd or init

You can then pass this Facter value down to your module and let it do its logic from there