armbian-build/lib/functions/host/host-utils.sh

23 lines
534 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2022-10-03 02:52:43 +00:00
# wait_for_package_manager
#
# * installation will break if we try to install when package manager is running
#
2022-10-08 11:17:30 +00:00
wait_for_package_manager() {
2022-10-03 02:52:43 +00:00
# exit if package manager is running in the back
while true; do
2022-10-08 11:17:30 +00:00
if [[ "$(
fuser /var/lib/dpkg/lock 2> /dev/null
echo $?
)" != 1 && "$(
fuser /var/lib/dpkg/lock-frontend 2> /dev/null
echo $?
)" != 1 ]]; then
display_alert "Package manager is running in the background." "Please wait! Retrying in 30 sec" "wrn"
sleep 30
else
break
2022-10-03 02:52:43 +00:00
fi
done
}