Some tweaks to the new dpkg lock detector

This commit is contained in:
DL6ER 2017-03-03 11:35:44 +01:00
parent 2c762899de
commit a535ca9db4
No known key found for this signature in database
GPG key ID: 00135ACBD90B28DD

View file

@ -90,27 +90,12 @@ if command -v apt-get &> /dev/null; then
test_dpkg_lock() { test_dpkg_lock() {
i=0 i=0
while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do
echo -en "\r::: Waiting for package manager to finish"
j=0
while [ $j -lt 6 ]; do
if [ $j -lt $i ]; then
echo -n "."
else
echo -n " "
fi
((j=j+1))
done
sleep 0.5 sleep 0.5
if [ $i -lt 6 ]; then
((i=i+1)) ((i=i+1))
else
i=0
fi
done done
# Add final newline only if we entered the loop at least once # Always return success, since we only return if there is no
if [ $j -gt 0 ]; then # lock (anymore)
echo "" return 0
fi
} }
elif command -v rpm &> /dev/null; then elif command -v rpm &> /dev/null; then
@ -764,7 +749,7 @@ update_package_cache() {
echo ":::" echo ":::"
echo -n "::: Updating local cache of available packages..." echo -n "::: Updating local cache of available packages..."
if eval ${UPDATE_PKG_CACHE} &> /dev/null; then if eval "${UPDATE_PKG_CACHE}" &> /dev/null; then
echo " done!" echo " done!"
else else
echo -n "\n!!! ERROR - Unable to update package cache. Please try \"${UPDATE_PKG_CACHE}\"" echo -n "\n!!! ERROR - Unable to update package cache. Please try \"${UPDATE_PKG_CACHE}\""