aboutsummaryrefslogtreecommitdiff
path: root/rel/files
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-06-19 03:51:59 +0300
committerrinpatch <rinpatch@sdf.org>2019-06-19 03:52:03 +0300
commita0a1361888a3986d589720a7eb39d49c913154f2 (patch)
tree8c86adab7da278d24c6f4c2a5a5a2f700936edf0 /rel/files
parent3d76420512111006f678f820d1a20f866b07bdb9 (diff)
downloadpleroma-a0a1361888a3986d589720a7eb39d49c913154f2.tar.gz
Refactor pleroma_ctl copying to a generic function for copying files into the release dir
Diffstat (limited to 'rel/files')
-rwxr-xr-xrel/files/bin/pleroma_ctl26
1 files changed, 26 insertions, 0 deletions
diff --git a/rel/files/bin/pleroma_ctl b/rel/files/bin/pleroma_ctl
new file mode 100755
index 000000000..ac7339762
--- /dev/null
+++ b/rel/files/bin/pleroma_ctl
@@ -0,0 +1,26 @@
+#!/bin/sh
+# XXX: This should be removed when elixir's releases get custom command support
+if [ -z "$1" ] || [ "$1" = "help" ]; then
+ echo "Usage: $(basename "$0") COMMAND [ARGS]
+
+ The known commands are:
+
+ create Create database schema (needs to be executed only once)
+ migrate Execute database migrations (needs to be done after updates)
+ rollback [VERSION] Rollback database migrations (needs to be done before downgrading)
+
+ and any mix tasks under Pleroma namespace, for example \`mix pleroma.user COMMAND\` is
+ equivalent to \`$(basename "$0") user COMMAND\`
+
+ By default pleroma_ctl will try calling into a running instance to execute non migration-related commands,
+ if for some reason this is undesired, set PLEROMA_CTL_RPC_DISABLED environment variable
+"
+else
+ SCRIPT=$(readlink -f "$0")
+ SCRIPTPATH=$(dirname "$SCRIPT")
+ if [ "$1" = "migrate" ] || [ "$1" = "rollback" ] || [ "$1" = "create" ] || [ -n "$PLEROMA_CTL_RPC_DISABLED" ]; then
+ "$SCRIPTPATH"/pleroma eval 'Pleroma.ReleaseTasks.run("'"$*"'")'
+ else
+ "$SCRIPTPATH"/pleroma rpc 'Pleroma.ReleaseTasks.run("'"$*"'")'
+ fi
+fi