Skip to content

Commit 75a1fca

Browse files
committed
refact: docker retry, use fake-hwclock
1 parent 16e2a12 commit 75a1fca

2 files changed

Lines changed: 41 additions & 18 deletions

File tree

‎system/cuos/first-run.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ if [[ -f "${SCRIPT_DIR}/custom-first-run.sh" ]]; then
2323
source "${SCRIPT_DIR}/custom-first-run.sh"
2424
fi
2525

26+
/usr/sbin/fake-hwclock save force
27+
2628
exit 0

‎updater/docker_environment.sh‎

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,46 @@ mount -t vfat -o "rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii
5353
# exit 1
5454
#fi
5555

56-
# Start dockerd and wait until it is ready:
57-
dockerd \
58-
--storage-driver btrfs \
59-
--iptables=false \
60-
--ip6tables=false \
61-
--ip-forward=false \
62-
--ip-masq=false \
63-
--bridge=none \
64-
--data-root "${DOCKER_DIR}" &
65-
DOCKERD_PID="$!"
66-
echo "Waiting for Docker to be ready..."
67-
counter=0
68-
until docker info >/dev/null 2>&1; do
69-
counter="$((counter + 1))"
70-
if [[ "${counter}" -gt 100 ]]; then
71-
raise "Could not start dockerd"
56+
57+
start_dockerd() {
58+
59+
# Start dockerd and wait until it is ready:
60+
dockerd \
61+
--storage-driver btrfs \
62+
--iptables=false \
63+
--ip6tables=false \
64+
--ip-forward=false \
65+
--ip-masq=false \
66+
--bridge=none \
67+
--data-root "${DOCKER_DIR}" &
68+
DOCKERD_PID="$!"
69+
echo "Waiting for Docker to be ready..."
70+
counter=0
71+
until docker info >/dev/null 2>&1; do
72+
counter="$((counter + 1))"
73+
if [[ "${counter}" -gt 100 ]]; then
74+
raise "Could not start dockerd"
75+
fi
76+
sleep 1
77+
if ! kill -0 "$DOCKERD_PID"; then
78+
return 1
79+
fi
80+
done
81+
if ! docker info >/dev/null 2>&1; then
82+
return 1
7283
fi
73-
sleep 1
74-
done
84+
return 0
85+
}
86+
87+
if ! start_dockerd; then
88+
if ! start_dockerd; then
89+
if ! start_dockerd; then
90+
if ! start_dockerd; then
91+
exit 1
92+
fi
93+
fi
94+
fi
95+
fi
7596

7697
docker info
7798

0 commit comments

Comments
 (0)