Download entrypoint.sh from Good12313/c2a: direct link, hf CLI and curl.
- Browser
- Download file 850 Bytes
-
https://huggingface.co/spaces/Good12313/c2a/resolve/main/entrypoint.sh
- Command line
-
hf download hf://spaces/Good12313/c2a/entrypoint.sh
-
curl -L -o entrypoint.sh https://huggingface.co/spaces/Good12313/c2a/resolve/main/entrypoint.sh
850 Bytes
| set -eu | |
| PERSIST_ROOT="${PERSIST_ROOT:-/data}" | |
| APP_DATA_DIR="${PERSIST_ROOT}/app-data" | |
| PERSIST_CONFIG="${PERSIST_ROOT}/config.json" | |
| DEFAULT_CONFIG="/app/config.default.json" | |
| mkdir -p "$APP_DATA_DIR" | |
| if [ ! -f "$PERSIST_CONFIG" ]; then | |
| if [ -f "$DEFAULT_CONFIG" ]; then | |
| cp "$DEFAULT_CONFIG" "$PERSIST_CONFIG" | |
| else | |
| printf '{}\n' > "$PERSIST_CONFIG" | |
| fi | |
| fi | |
| link_path() { | |
| target="$1" | |
| link="$2" | |
| if [ -L "$link" ]; then | |
| current="$(readlink "$link" || true)" | |
| if [ "$current" = "$target" ]; then | |
| return | |
| fi | |
| rm "$link" | |
| elif [ -e "$link" ]; then | |
| backup="${link}.image-default" | |
| if [ ! -e "$backup" ]; then | |
| mv "$link" "$backup" | |
| else | |
| rm -rf "$link" | |
| fi | |
| fi | |
| ln -s "$target" "$link" | |
| } | |
| link_path "$APP_DATA_DIR" /app/data | |
| link_path "$PERSIST_CONFIG" /app/config.json | |
| exec "$@" | |