Skip to content

Commit 5d64329

Browse files
authored
Merge pull request #1818 from wloxyz/master
Add extra environment debugging information in webodm.sh
2 parents 246dedf + e5a722f commit 5d64329

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

webodm.sh

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,54 @@ check_command(){
339339
}
340340

341341
environment_check(){
342-
check_command "docker" "https://www.docker.com/"
343-
check_docker_compose
342+
if [[ $WO_DEBUG = "YES" ]]; then
343+
local DOCKER_VERSION
344+
local COMPOSE_VERSION
345+
local MEDIA_DIR_OWNER
346+
local DB_DIR_OWNER
347+
echo "================================"
348+
echo "Extra debugging information:"
349+
echo "================================"
350+
echo "Host environment: $OSTYPE"
351+
if [[ "$(groups)" == *"docker"* ]]; then
352+
echo "You are in the docker group"
353+
else
354+
echo "You are not in the docker group"
355+
fi
356+
fi
357+
358+
check_command "docker" "https://www.docker.com/"
359+
check_docker_compose
360+
361+
if [[ $WO_DEBUG = "YES" ]]; then
362+
if [ -d $WO_MEDIA_DIR ]; then
363+
MEDIA_DIR_OWNER=$(stat -c "%U" $WO_MEDIA_DIR)
364+
if [[ $MEDIA_DIR_OWNER != $(whoami) ]]; then
365+
echo "You do not own the media directory. It is owned by $MEDIA_DIR_OWNER."
366+
fi
367+
fi
368+
if [ -d $WO_DB_DIR ]; then
369+
DB_DIR_OWNER=$(stat -c "%U" $WO_DB_DIR)
370+
if [[ $DB_DIR_OWNER != $(whoami) ]]; then
371+
echo "You do not own the database directory. It is owned by $DB_DIR_OWNER."
372+
fi
373+
374+
fi
375+
DOCKER_VERSION=$(docker --version)
376+
# remove stderr in case podman throws complaints, ensure only compose ver is taken
377+
COMPOSE_VERSION=$($docker_compose version 2> /dev/null | head -n 1)
378+
echo "Docker version: $DOCKER_VERSION"
379+
echo "Compose version: $COMPOSE_VERSION"
380+
if [ -z "$DOCKER_HOST" ]; then
381+
echo "DOCKER_HOST is unset"
382+
if [[ "$($docker_compose -v)" != "podman"* ]] && [[ "$DOCKER_VERSION" == "podman"* ]]; then
383+
echo "You seem to be using podman with docker-compose instead of podman-compose. The above variable may need to be set, see https://docs.opendronemap.org/tutorials/#using-podman for more information."
384+
fi
385+
else
386+
echo "DOCKER_HOST: $DOCKER_HOST"
387+
fi
388+
echo ""
389+
fi
344390
}
345391

346392
run(){

0 commit comments

Comments
 (0)