make initial docker socket check failproof

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-01-21 14:02:35 +01:00
parent bfc8526ddd
commit 0837ac9670
2 changed files with 6 additions and 1 deletions

View file

@ -35,10 +35,14 @@ elif ! sudo -u www-data test -r /var/run/docker.sock; then
fi
# Check if api version is supported
if ! docker info &>/dev/null; then
echo "Cannot connect to the docker socket. Cannot proceed."
exit 1
fi
API_VERSION_FILE="$(find ./ -name DockerActionManager.php | head -1)"
API_VERSION="$(grep -oP 'const API_VERSION.*\;' "$API_VERSION_FILE" | grep -oP [0-9]+.[0-9]+ | head -1)"
API_VERSION_NUMB="$(echo "$API_VERSION" | sed 's/\.//')"
LOCAL_API_VERSION_NUMB="$(curl -s --unix-socket /var/run/docker.sock http://"$API_VERSION"/version | sed 's/,/\n/g' | grep ApiVersion | grep -oP [0-9]+.[0-9]+ | head -1 | sed 's/\.//')"
LOCAL_API_VERSION_NUMB="$(docker version | grep -i "api version" | grep -oP [0-9]+.[0-9]+ | head -1 | sed 's/\.//')"
if [ -n "$LOCAL_API_VERSION_NUMB" ] && [ -n "$API_VERSION_NUMB" ]; then
if ! [ "$LOCAL_API_VERSION_NUMB" -ge "$API_VERSION_NUMB" ]; then
echo "Docker v$API_VERSION is not supported by your docker engine. Cannot proceed."

View file

@ -83,6 +83,7 @@ if ! [ -f "/mnt/ncdata/skip.update" ]; then
break
else
echo "Curl didn't produce a 200 status, is appstore reachable?"
sleep 5
fi
done