Fix writing to stderr from docker entrypoint
This commit is contained in:
parent
e7795550fc
commit
db360dea1f
1 changed files with 7 additions and 4 deletions
|
@ -17,20 +17,23 @@ export PGID="$(id -g archivebox)"
|
||||||
|
|
||||||
# Check the permissions of the data dir (or create if it doesn't exist)
|
# Check the permissions of the data dir (or create if it doesn't exist)
|
||||||
if [[ -d "$DATA_DIR/archive" ]]; then
|
if [[ -d "$DATA_DIR/archive" ]]; then
|
||||||
if touch "$DATA_DIR/archive/.permissions_test_safe_to_delete"; then
|
if touch "$DATA_DIR/archive/.permissions_test_safe_to_delete" 2>/dev/null; then
|
||||||
# It's fine, we are able to write to the data directory
|
# It's fine, we are able to write to the data directory
|
||||||
rm "$DATA_DIR/archive/.permissions_test_safe_to_delete"
|
rm "$DATA_DIR/archive/.permissions_test_safe_to_delete"
|
||||||
# echo "[√] Permissions are correct"
|
# echo "[√] Permissions are correct"
|
||||||
else
|
else
|
||||||
echo "[X] Error: ArchiveBox (uid=$PUID) is not able to write to your ./data dir. Fix the permissions and retry:" >2
|
echo "[X] Error: ArchiveBox (uid=$PUID) is not able to write to your ./data dir. Fix the permissions and retry:" >&2
|
||||||
echo " \$ chown -R $PUID:$PGID data" >2
|
echo " \$ chown -R $PUID:$PGID data" >&2
|
||||||
echo " You may need to pass PUID & PGID to the Docker container: https://docs.linuxserver.io/general/understanding-puid-and-pgid" >2
|
echo " You may need to pass PUID & PGID to the Docker container: https://docs.linuxserver.io/general/understanding-puid-and-pgid" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# create data directory
|
# create data directory
|
||||||
mkdir -p "$DATA_DIR/logs"
|
mkdir -p "$DATA_DIR/logs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# force set the ownership of the data dir contents to the archivebox user and group
|
||||||
|
# this is needed because Docker Desktop often does not map user permissions from the host properly
|
||||||
chown $ARCHIVEBOX_USER:$ARCHIVEBOX_USER "$DATA_DIR" "$DATA_DIR"/*
|
chown $ARCHIVEBOX_USER:$ARCHIVEBOX_USER "$DATA_DIR" "$DATA_DIR"/*
|
||||||
|
|
||||||
# Drop permissions to run commands as the archivebox user
|
# Drop permissions to run commands as the archivebox user
|
||||||
|
|
Loading…
Reference in a new issue