yacy_search_server/bin/checkDataFolder.sh
luccioman 17ad1f7e65 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.
2018-11-26 18:26:52 +01:00

17 lines
609 B
Bash
Executable File

#!/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