about summary refs log tree commit diff
path: root/build.sh
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2022-06-06 14:04:52 -0500
committerStarfall <us@starfall.systems>2022-06-06 14:04:52 -0500
commitbd872c93333b90f85d90bc60f5690537bee15ee2 (patch)
tree03c5ff1c7d372882af4b1c84849345fa2c503069 /build.sh
parent78266a002b4735caaef07098ba66419fd71f47c1 (diff)
build.sh: detect if starting dockerd is hanging
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/build.sh b/build.sh
index 4c252d73f..7742f3789 100755
--- a/build.sh
+++ b/build.sh
@@ -1,9 +1,21 @@
-#!/usr/bin/env zsh
+#!/usr/bin/env -S zsh -uo pipefail
+
 commit=`git rev-parse HEAD | cut -c -7`
-echo $commit
+echo "Building commit $commit"
 
 yarn install
-systemctl start docker
+
+if ! systemctl is-active docker &>/dev/null; then
+	timeout 5s systemctl start docker
+	if [ $? -eq 124 ]; then
+		echo 'Docker start may be hanging... consider manual intervention:'
+		echo '  rm -rf /var/run/docker'
+		echo '  rm -f /var/run/docker.sock'
+		echo '  systemctl start docker docker.socket'
+		exit 124
+	fi
+fi
+
 docker build --build-arg SOURCE_COMMIT=$commit --tag pluralcafe/mastodon:edge .
 
 echo 'Docker image built. Push to Docker Hub with `docker push pluralcafe/mastodon:edge`.'