Created
April 22, 2018 16:33
-
-
Save tedivm/e11ebfdc25dc1d7935a3d5640a1f1c90 to your computer and use it in GitHub Desktop.
A BASH function to wait for `apt` to finish and release all locks.
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
#!/usr/bin/env bash | |
apt_wait () { | |
while sudo fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do | |
sleep 1 | |
done | |
while sudo fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do | |
sleep 1 | |
done | |
if [ -f /var/log/unattended-upgrades/unattended-upgrades.log ]; then | |
while sudo fuser /var/log/unattended-upgrades/unattended-upgrades.log >/dev/null 2>&1 ; do | |
sleep 1 | |
done | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment