Created
December 17, 2018 19:42
-
-
Save hrpatel/117419dcc3a75e46f79a9f1dce99ef52 to your computer and use it in GitHub Desktop.
Wait for apt/dpkg to finish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timeout=10 | |
function wait_for_apt_deb { | |
while sudo fuser /var/{lib/{dpkg,apt/lists},cache/apt/archives}/lock &>/dev/null 2>&1; do | |
echo "Waiting for apt/dpkg lock to release, sleeping ${timeout}s" | |
sleep "${timeout}" | |
done | |
} | |
wait_for_deb && apt-get install vim |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment