From 830bd9a3c2a85dc2d14671d1310dbbe817d4b415 Mon Sep 17 00:00:00 2001 From: Botspot Date: Tue, 10 Aug 2021 19:35:55 -0500 Subject: [PATCH] pkg_install: use apt_lock_wait --- pkg-install | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/pkg-install b/pkg-install index bc86713..e54c3d4 100755 --- a/pkg-install +++ b/pkg-install @@ -17,35 +17,19 @@ error() { PKG_LIST="$1" #quotation-marked, space-seperated list of package names to install app="$(basename "$2")" #remove any slashes to just get program name - - reduceapt() { #remove unwanted lines from apt output grep -v "apt does not have a stable CLI interface.\|Reading package lists...\|Building dependency tree\|Reading state information...\|Need to get\|After this operation,\|Get:\|Fetched\|Selecting previously unselected package\|Preparing to unpack\|Unpacking \|Setting up \|Processing triggers for " } echo "Running pkg-install..." - if [ -z "$PKG_LIST" ];then error "No package names specified to pkg-install!" elif [ -z "$app" ];then error "No app name specified to pkg-install!" fi -echo -n "Waiting until APT locks are released... " -{ -while sudo fuser /var/lib/dpkg/lock &>/dev/null ; do - sleep 0.5 -done -while sudo fuser /var/lib/apt/lists/lock &>/dev/null ; do - sleep 0.5 -done -if [ -f /var/log/unattended-upgrades/unattended-upgrades.log ]; then - while sudo fuser /var/log/unattended-upgrades/unattended-upgrades.log &>/dev/null ; do - sleep 0.5 - done -fi -echo "Done" -} +source "${DIRECTORY}/api" +apt_lock_wait #sudo apt update {