diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2023-08-04 09:38:01 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2023-08-04 09:38:01 +0000 |
commit | 1062185ba03ffa03f0dfcfc11f948285b2ffd610 (patch) | |
tree | 9fcc57c0a14dfccabd4571200c127438bf4a754b /lib/mix/tasks | |
parent | 819fccb7d1391ad88f5c236f32390b3e0430ef6c (diff) | |
parent | 6a0fd77c48946b4b2100585b4f32d125680f5f82 (diff) | |
download | pleroma-1062185ba03ffa03f0dfcfc11f948285b2ffd610.tar.gz pleroma-1062185ba03ffa03f0dfcfc11f948285b2ffd610.zip |
Merge branch 'mergeback/2.5.3' into 'develop'
Mergeback: 2.5.3
Closes #3135
See merge request pleroma/pleroma!3927
Diffstat (limited to 'lib/mix/tasks')
-rw-r--r-- | lib/mix/tasks/pleroma/instance.ex | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/mix/tasks/pleroma/instance.ex b/lib/mix/tasks/pleroma/instance.ex index 5c93f19ff..5d8b254a2 100644 --- a/lib/mix/tasks/pleroma/instance.ex +++ b/lib/mix/tasks/pleroma/instance.ex @@ -266,12 +266,20 @@ defmodule Mix.Tasks.Pleroma.Instance do config_dir = Path.dirname(config_path) psql_dir = Path.dirname(psql_path) + # Note: Distros requiring group read (0o750) on those directories should + # pre-create the directories. [config_dir, psql_dir, static_dir, uploads_dir] |> Enum.reject(&File.exists?/1) - |> Enum.map(&File.mkdir_p!/1) + |> Enum.each(fn dir -> + File.mkdir_p!(dir) + File.chmod!(dir, 0o700) + end) shell_info("Writing config to #{config_path}.") + # Sadly no fchmod(2) equivalent in Elixir… + File.touch!(config_path) + File.chmod!(config_path, 0o640) File.write(config_path, result_config) shell_info("Writing the postgres script to #{psql_path}.") File.write(psql_path, result_psql) @@ -290,8 +298,7 @@ defmodule Mix.Tasks.Pleroma.Instance do else shell_error( "The task would have overwritten the following files:\n" <> - (Enum.map(will_overwrite, &"- #{&1}\n") |> Enum.join("")) <> - "Rerun with `--force` to overwrite them." + Enum.map_join(will_overwrite, &"- #{&1}\n") <> "Rerun with `--force` to overwrite them." ) end end |