From 99ed97836ff42565a30dcb7ecbf3432778d19d15 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Sun, 3 Nov 2024 16:40:23 -0800 Subject: [PATCH] Prevent accidentally mounting home folder as DATA_DIR --- bin/docker_entrypoint.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/docker_entrypoint.sh b/bin/docker_entrypoint.sh index 18114e13..83e3bdbc 100755 --- a/bin/docker_entrypoint.sh +++ b/bin/docker_entrypoint.sh @@ -58,6 +58,13 @@ groupmod -o -g "${PGID:-$DETECTED_PGID}" "$ARCHIVEBOX_USER" > /dev/null 2>&1 export PUID="$(id -u archivebox)" export PGID="$(id -g archivebox)" +# Check if user attempted to run it in the root of their home folder or hard drive (common mistake) +if [[ -d "$DATA_DIR/Documents" || -d "$DATA_DIR/.config" || -d "$DATA_DIR/usr" ]]; then + echo -e "\n[X] ERROR: ArchiveBox was run from inside a home folder" + echo -e " Make sure you are inside an existing collection directory or a new empty directory and try again" + exit 3 +fi + # Check the permissions of the data dir (or create if it doesn't exist) if [[ -d "$DATA_DIR/archive" ]]; then if touch "$DATA_DIR/archive/.permissions_test_safe_to_delete" 2>/dev/null; then