Merge pull request #158 from nextcloud/enh/28/make-docker-socket-check-failproof

make initial docker socket check failproof
This commit is contained in:
Simon L 2022-01-21 14:12:21 +01:00 committed by GitHub
commit ee124bf894
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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