diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/cmd.lua | 4 | ||||
-rw-r--r-- | src/luarocks/core/cfg.lua | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua index be749c16..9255cff8 100644 --- a/src/luarocks/cmd.lua +++ b/src/luarocks/cmd.lua | |||
@@ -85,7 +85,7 @@ do | |||
85 | replace_tree(args, root_dir) | 85 | replace_tree(args, root_dir) |
86 | end | 86 | end |
87 | elseif args["local"] then | 87 | elseif args["local"] then |
88 | if not cfg.home_tree then | 88 | if os.getenv("USER") == "root" then |
89 | return nil, "The --local flag is meant for operating in a user's home directory.\n".. | 89 | return nil, "The --local flag is meant for operating in a user's home directory.\n".. |
90 | "You are running as a superuser, which is intended for system-wide operation.\n".. | 90 | "You are running as a superuser, which is intended for system-wide operation.\n".. |
91 | "To force using the superuser's home, use --tree explicitly." | 91 | "To force using the superuser's home, use --tree explicitly." |
@@ -642,7 +642,7 @@ function cmd.run_command(description, commands, external_namespace, ...) | |||
642 | end | 642 | end |
643 | 643 | ||
644 | -- if running as superuser, use system cache dir | 644 | -- if running as superuser, use system cache dir |
645 | if not cfg.home_tree then | 645 | if os.getenv("USER") == "root" then |
646 | cfg.local_cache = dir.path(fs.system_cache_dir(), "luarocks") | 646 | cfg.local_cache = dir.path(fs.system_cache_dir(), "luarocks") |
647 | end | 647 | end |
648 | 648 | ||
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua index c19f7d3b..b2b26fad 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua | |||
@@ -86,8 +86,8 @@ local function set_confdirs(cfg, platforms, hardcoded_sysconfdir) | |||
86 | sysconfdir = detect_sysconfdir() | 86 | sysconfdir = detect_sysconfdir() |
87 | end | 87 | end |
88 | cfg.home = os.getenv("HOME") or "" | 88 | cfg.home = os.getenv("HOME") or "" |
89 | cfg.home_tree = (os.getenv("USER") ~= "root") and cfg.home.."/.luarocks" | 89 | cfg.home_tree = cfg.home.."/.luarocks" |
90 | cfg.homeconfdir = cfg.home.."/.luarocks" | 90 | cfg.homeconfdir = cfg.home_tree |
91 | cfg.sysconfdir = sysconfdir or "/etc/luarocks" | 91 | cfg.sysconfdir = sysconfdir or "/etc/luarocks" |
92 | end | 92 | end |
93 | end | 93 | end |