Skip to content

Commit 75290b4

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 8047d1c commit 75290b4

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

lib/puppet/util/run_mode.rb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,48 @@ def vendor_module_dir
105105
end
106106
end
107107

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

0 commit comments

Comments
 (0)