From 4e8c037811de3192850495470f58c207c8ec3ce0 Mon Sep 17 00:00:00 2001 From: RPI News <44128563+mobilegmYT@users.noreply.github.com> Date: Fri, 23 Jul 2021 13:33:55 -0600 Subject: [PATCH] Wait for apt locks to be removed on uninstall too --- apps/Minecraft Pi (Modded)/uninstall | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/Minecraft Pi (Modded)/uninstall b/apps/Minecraft Pi (Modded)/uninstall index fca5a4b..e4b1e41 100755 --- a/apps/Minecraft Pi (Modded)/uninstall +++ b/apps/Minecraft Pi (Modded)/uninstall @@ -7,6 +7,22 @@ function error { exit 1 } +# Wait for apt lock to be released +i=0 +while sudo fuser /var/{lib/{dpkg,apt/lists},cache/apt/archives}/lock > /dev/null 2>&1 +do + case $(($i % 4)) in + 0) j="-";; + 1) j="\\";; + 2) j="|";; + 3) j="/";; + esac + printf "\r[$j] Waiting for other package managers to finish..." + sleep 0.5 + ((i+=1)) +done +[[ $i -gt 0 ]] && printf "Done.\n" + sudo apt-get remove -y minecraft-pi-reborn-native &>/dev/null || true "${DIRECTORY}/purge-installed" "$(dirname "$0")" || exit 1