Comparison

util/startup.lua @ 11304:c022b582d312

util.startup: Don't create installer plugin path (as root) Since this runs before dropping root, the directory ends up being owned by root, resulting in luarocks failing to install anything, since by then it would be running as the prosody user. luarocks creates this directory if needed, so creating it during startup is not necessary. One potential issue is if the directory is somewhere where Prosody can't write, but then you will simply have to create it yourself with the appropriate permissions.
author Kim Alvefur <zash@zash.se>
date Sun, 24 Jan 2021 15:57:48 +0100
parent 11152:89162d27e1b1
child 11305:cd8516a77255
comparison
equal deleted inserted replaced
11303:0d932bf3a0f7 11304:c022b582d312
269 function startup.setup_plugin_install_path() 269 function startup.setup_plugin_install_path()
270 local installer_plugin_path = config.get("*", "installer_plugin_path") or (CFG_DATADIR or "data").."/custom_plugins"; 270 local installer_plugin_path = config.get("*", "installer_plugin_path") or (CFG_DATADIR or "data").."/custom_plugins";
271 local path_sep = package.config:sub(3,3); 271 local path_sep = package.config:sub(3,3);
272 -- TODO Figure out what this should be relative to, because CWD could be anywhere 272 -- TODO Figure out what this should be relative to, because CWD could be anywhere
273 installer_plugin_path = config.resolve_relative_path(require "lfs".currentdir(), installer_plugin_path); 273 installer_plugin_path = config.resolve_relative_path(require "lfs".currentdir(), installer_plugin_path);
274 -- TODO Can probably move directory creation to the install command
275 require "lfs".mkdir(installer_plugin_path);
276 require"util.paths".complement_lua_path(installer_plugin_path); 274 require"util.paths".complement_lua_path(installer_plugin_path);
277 -- luacheck: ignore 111 275 -- luacheck: ignore 111
278 CFG_PLUGINDIR = installer_plugin_path..path_sep..(CFG_PLUGINDIR or "plugins"); 276 CFG_PLUGINDIR = installer_plugin_path..path_sep..(CFG_PLUGINDIR or "plugins");
279 prosody.paths.installer = installer_plugin_path; 277 prosody.paths.installer = installer_plugin_path;
280 prosody.paths.plugins = CFG_PLUGINDIR; 278 prosody.paths.plugins = CFG_PLUGINDIR;