summaryrefslogtreecommitdiff
path: root/lib/mix/tasks/pleroma/instance.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mix/tasks/pleroma/instance.ex')
-rw-r--r--lib/mix/tasks/pleroma/instance.ex28
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/mix/tasks/pleroma/instance.ex b/lib/mix/tasks/pleroma/instance.ex
index ac8688424..da27a99d0 100644
--- a/lib/mix/tasks/pleroma/instance.ex
+++ b/lib/mix/tasks/pleroma/instance.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.Instance do
@@ -161,12 +161,21 @@ defmodule Mix.Tasks.Pleroma.Instance do
)
|> Path.expand()
+ {strip_uploads_message, strip_uploads_default} =
+ if Pleroma.Utils.command_available?("exiftool") do
+ {"Do you want to strip location (GPS) data from uploaded images? This requires exiftool, it was detected as installed. (y/n)",
+ "y"}
+ else
+ {"Do you want to strip location (GPS) data from uploaded images? This requires exiftool, it was detected as not installed, please install it if you answer yes. (y/n)",
+ "n"}
+ end
+
strip_uploads =
get_option(
options,
:strip_uploads,
- "Do you want to strip location (GPS) data from uploaded images? (y/n)",
- "y"
+ strip_uploads_message,
+ strip_uploads_default
) === "y"
anonymize_uploads =
@@ -233,6 +242,13 @@ defmodule Mix.Tasks.Pleroma.Instance do
rum_enabled: rum_enabled
)
+ config_dir = Path.dirname(config_path)
+ psql_dir = Path.dirname(psql_path)
+
+ [config_dir, psql_dir, static_dir, uploads_dir]
+ |> Enum.reject(&File.exists?/1)
+ |> Enum.map(&File.mkdir_p!/1)
+
shell_info("Writing config to #{config_path}.")
File.write(config_path, result_config)
@@ -253,7 +269,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
else
shell_error(
"The task would have overwritten the following files:\n" <>
- (Enum.map(paths, &"- #{&1}\n") |> Enum.join("")) <>
+ (Enum.map(will_overwrite, &"- #{&1}\n") |> Enum.join("")) <>
"Rerun with `--force` to overwrite them."
)
end
@@ -266,10 +282,6 @@ defmodule Mix.Tasks.Pleroma.Instance do
indexable: indexable
)
- unless File.exists?(static_dir) do
- File.mkdir_p!(static_dir)
- end
-
robots_txt_path = Path.join(static_dir, "robots.txt")
if File.exists?(robots_txt_path) do