Your question is: "How can I make
apt-get to wait for another instance to finish?"
This answer is good, nothing to say, but is only an alternative. If you use
aptdcon, you don't make
apt-get to wait.
This answer is also good. You can create an alias for
sudo waitforapt && sudo apt-get install whatever and in the future to use that alias. But you have to remember to use it all the time when another software manager is running.
Reading again your question, I understand that you wish a behavior for
apt-get similar to that from the next screen cast:
How I made it?
I create a new script called
apt-get (wrapper for
/usr/local/sbin directory with the following bash code inside:
while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do
case $(($i % 4)) in
0 ) j="-" ;;
1 ) j="\\" ;;
2 ) j="|" ;;
3 ) j="/" ;;
echo -en "\r[$j] Waiting for other software managers to finish..."
Don't forget to make it executable:
sudo chmod +x /usr/local/sbin/apt-get
Before to test, check if everything is ok. The output of
which apt-get command should be now
/usr/local/sbin/apt-get. The reason is: by default, the
/usr/local/sbin directory is placed before
/usr/bin directory in user or root