Skip to content

Instantly share code, notes, and snippets.

@hrpatel
Created December 17, 2018 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrpatel/117419dcc3a75e46f79a9f1dce99ef52 to your computer and use it in GitHub Desktop.
Save hrpatel/117419dcc3a75e46f79a9f1dce99ef52 to your computer and use it in GitHub Desktop.
Wait for apt/dpkg to finish
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