1 # A facter fact to determine the root home directory.
2 # This varies on PE supported platforms and may be
3 # reconfigured by the end user.
5 module Facter::Util::RootHome
8 root_ent = Facter::Util::Resolution.exec("getent passwd root")
9 # The home directory is the sixth element in the passwd entry
10 # If the platform doesn't have getent, root_ent will be nil and we should
11 # return it straight away.
12 root_ent && root_ent.split(":")[5]
17 Facter.add(:root_home) do
18 setcode { Facter::Util::RootHome.get_root_home }
21 Facter.add(:root_home) do
22 confine :kernel => :darwin
24 str = Facter::Util::Resolution.exec("dscacheutil -q user -a name root")
26 str.split("\n").each do |pair|
27 key,value = pair.split(/:/)