summaryrefslogtreecommitdiff
path: root/bin/checkDataFolder.sh
diff options
context:
space:
mode:
authorluccioman <luccioman@users.noreply.github.com>2018-11-26 18:26:52 +0100
committerluccioman <luccioman@users.noreply.github.com>2018-11-26 18:26:52 +0100
commit17ad1f7e65475f6f5de96f69e74c938fac699768 (patch)
tree44b48d3ddabff4233fe3acab72a8b2b913bf05e2 /bin/checkDataFolder.sh
parent07730fe0400d009fc667ce03ab3af76b54ad67ab (diff)
Added support for custom DATA path in shell scripts
When the YACY_DATA_PATH environment variable is set, shell scripts will now use the given path instead of relative ../DATA which remains the default when the variable is not set. Necessary in the context of Snap package (see issue #254) as YaCy is started with startYACY.sh and an absolute DATA parent path in parameter.
Diffstat (limited to 'bin/checkDataFolder.sh')
-rwxr-xr-xbin/checkDataFolder.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/checkDataFolder.sh b/bin/checkDataFolder.sh
new file mode 100755
index 000000000..7dd45079a
--- /dev/null
+++ b/bin/checkDataFolder.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env sh
+# Fill the YACY_BIN_PATH, YACY_APP_PATH and the YACY_DATA_PATH (when empty) relatively to the current working directory
+# Then check that the provided YaCy DATA folder exists
+# Exits with an error message and status 2 when the DATA folder is not found
+
+YACY_BIN_PATH="`pwd`"
+YACY_APP_PATH="`dirname $YACY_BIN_PATH`"
+
+if [ -z "$YACY_DATA_PATH" ]; then
+ YACY_DATA_PATH="$YACY_APP_PATH/DATA"
+fi
+
+if [ ! -d "$YACY_DATA_PATH" ]; then
+ echo "Invalid YaCy DATA folder path : $YACY_DATA_PATH"
+ echo "Please fill the YACY_DATA_PATH environment variable with a valid YaCy DATA folder path."
+ exit 2
+fi \ No newline at end of file