# HG changeset patch # User Kim Alvefur # Date 1540394314 -7200 # Node ID 9dc7280dd8dc7eddc2188e9e0b996d9c25bdf2e6 # Parent b8bfcfbe5126cc5ad36935f3fe76605eac2818ba# Parent cbd3b9d4c60b5c7614c07b3fe4a2ba9950b15a74 Merge 0.10->trunk diff -r b8bfcfbe5126 -r 9dc7280dd8dc prosodyctl --- a/prosodyctl Sat Oct 20 20:22:55 2018 +0200 +++ b/prosodyctl Wed Oct 24 17:18:34 2018 +0200 @@ -657,7 +657,10 @@ 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 @@ 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!)