〖Linux〗apt-get wait for another apt process
2746 ワード
#!/bin/bash
i=0
tput sc
while fuser /var/lib/dpkg/lock >/dev/null 2>&1 || \
fuser /var/cache/apt/archives/lock >/dev/null 2>&1; do
case $(($i % 4)) in
0 ) j="-" ;;
1 ) j="\\" ;;
2 ) j="|" ;;
3 ) j="/" ;;
esac
tput rc
echo -en "\r[$j] Waiting for other software managers to finish..."
sleep 0.5
((i=i+1))
done
/usr/bin/apt-get "$@"
Save to/usr/local/sbin/apt-get, then chmod +x/usr/local/sbin/apt-get.
参考文献:
[1] http://askubuntu.com/questions/373425/how-can-i-make-apt-get-wait-for-another-instance-to-finish