Skip to content

Commit 5d8203d

Browse files
authored
Add loop to wait for apt lock release (#70)
1 parent 043c595 commit 5d8203d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

files/oke-ubuntu-cloud-init.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ Suites: stable
3030
Components: main
3131
Trusted: yes
3232
EOF
33+
# Wait for apt lock and install the package
34+
while fuser /var/{lib/{dpkg/{lock,lock-frontend},apt/lists},cache/apt/archives}/lock >/dev/null 2>&1; do
35+
echo "Waiting for dpkg/apt lock"
36+
sleep 1
37+
done
3338

3439
apt-get -y update
3540
apt-get -y install "$oke_package_name"
@@ -59,4 +64,4 @@ EOF
5964
;;
6065
esac
6166

62-
echo "OKE setup completed successfully."
67+
echo "OKE setup completed successfully."

0 commit comments

Comments
 (0)