Skip to content

Commit 1accadc

Browse files
committed
Introduce a Linux FHS run mode
The idea is that distro native packages can use this runmode without having to patch the code base. This is still not complete since there's no automatic detection of when to use this.
1 parent af1b3d6 commit 1accadc

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

lib/puppet/util/run_mode.rb

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,53 @@ def vendor_module_dir
103103
end
104104
end
105105

106+
class LinuxFHSRunMode < RunMode
107+
def conf_dir
108+
# TODO: ENV['XDG_CONFIG_HOME']
109+
which_dir("/etc/puppet", "~/.config/puppet")
110+
end
111+
112+
def code_dir
113+
File.join(conf_dir, 'code')
114+
end
115+
116+
def var_dir
117+
# TODO: ENV['XDG_DATA_HOME']
118+
which_dir("/var/lib/puppet", "~/.local/share/puppet")
119+
end
120+
121+
def public_dir
122+
# TODO: ENV['XDG_CACHE_HOME']
123+
which_dir("/var/cache/puppet/public", "~/.cache/puppet/public")
124+
end
125+
126+
def run_dir
127+
# TODO ENV['XDG_RUNTIME_DIR']
128+
which_dir("/run/puppet", "/run/user/#{Etc.getpwuid.uid}")
129+
end
130+
131+
def log_dir
132+
# TODO ENV['XDG_STATE_HOME']
133+
which_dir("/var/log/puppet", "~/.local/state/puppet/logs")
134+
end
135+
136+
def pkg_config_path
137+
# automatically picked up
138+
end
139+
140+
def gem_cmd
141+
'/usr/bin/gem'
142+
end
143+
144+
def common_module_dir
145+
'/usr/share/puppet/modules'
146+
end
147+
148+
def vendor_module_dir
149+
'/usr/share/puppet/vendor_modules'
150+
end
151+
end
152+
106153
class WindowsRunMode < RunMode
107154
def conf_dir
108155
which_dir(File.join(windows_common_base("puppet/etc")), "~/.puppetlabs/etc/puppet")

0 commit comments

Comments
 (0)