aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-24 17:18:34 +0200
committerKim Alvefur <zash@zash.se>2018-10-24 17:18:34 +0200
commite12412bc080a70f9d90a4d42cede63b8119f3b34 (patch)
treee7bf7b44c00c856ddb4430a41fae7d5cfdd45ec1 /prosodyctl
parent3d06d7c30922b8cd1d37bbd36f6bb8865eca19bf (diff)
parent2dd5ee93572d91455ad7bcf84e9555b756c5ffc5 (diff)
downloadprosody-e12412bc080a70f9d90a4d42cede63b8119f3b34.tar.gz
prosody-e12412bc080a70f9d90a4d42cede63b8119f3b34.zip
Merge 0.10->trunk
Diffstat (limited to 'prosodyctl')
-rwxr-xr-xprosodyctl8
1 files changed, 6 insertions, 2 deletions
diff --git a/prosodyctl b/prosodyctl
index 98063d4a..9a30ce30 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -657,7 +657,10 @@ local function copy(from, to, umask, owner, group)
end
assert(input:close());
assert(output:close());
- if owner and group then
+ if not prosody.installed then
+ -- FIXME this is possibly specific to GNU chown
+ os.execute(("chown -c --reference=%s %s"):format(sh_esc(cert_basedir), sh_esc(to)));
+ elseif owner and group then
local ok = os.execute(("chown %s:%s %s"):format(sh_esc(owner), sh_esc(group), sh_esc(to)));
assert(ok == true or ok == 0, "Failed to change ownership of "..to);
end
@@ -734,7 +737,8 @@ function commands.cert(arg)
show_warning("The directory "..cert_basedir.." does not exist");
return 1; -- TODO Should we create it?
end
- if pposix.getuid() ~= cert_dir_attrs.uid then
+ local uid = pposix.getuid();
+ if uid ~= 0 and uid ~= cert_dir_attrs.uid then
show_warning("The directory "..cert_basedir.." is not owned by the current user, won't be able to write files to it");
return 1;
elseif not cert_dir_attrs.permissions then -- COMPAT with LuaFilesystem < 1.6.2 (hey CentOS!)