From c25296eee23885759b32d39055f0e3e4d4726fd0 Mon Sep 17 00:00:00 2001 From: Botspot Date: Sat, 14 Aug 2021 23:01:25 -0500 Subject: [PATCH] pkg-install: use sudo -E --- pkg-install | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg-install b/pkg-install index 115a345..fc12e26 100755 --- a/pkg-install +++ b/pkg-install @@ -52,7 +52,7 @@ APT reported an unsigned repository. This script will try to repair it. Waiting 10 seconds... Press Ctrl+C to cancel.\e[39m" sleep 10 echo -e '\n\e[93mAttempting to sign unsigned repositories...\e[39m' - sudo apt update 2>&1 1>/dev/null | sed -ne 's/.*NO_PUBKEY //p' | while read key; do if ! [[ ${keys[*]} =~ "$key" ]]; then sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys "$key"; keys+=("$key"); fi; done + sudo -E apt update 2>&1 1>/dev/null | sed -ne 's/.*NO_PUBKEY //p' | while read key; do if ! [[ ${keys[*]} =~ "$key" ]]; then sudo -E apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys "$key"; keys+=("$key"); fi; done if [ $? == 0 ];then echo -e '\e[93mDone. Please try installing the same app again.\e[39m' else @@ -125,7 +125,7 @@ apt_lock_wait #sudo apt update { echo -e "Running \e[4msudo a\e[0mp\e[4mt u\e[0mp\e[4mdate\e[0m..." -output="$(sudo LANG=C LC_ALL=C apt update 2>&1)" +output="$(sudo -E apt update 2>&1)" exitcode=$? #inform user about autoremovable packages @@ -167,13 +167,13 @@ for package in $PKG_LIST ;do apt_lock_wait #install it and reduce apt's output - output="$(sudo LANG=C LC_ALL=C apt install -y --no-install-recommends "$package" 2>&1 | reduceapt | tee /dev/stderr)" + output="$(sudo -E apt install -yf --no-install-recommends "$package" 2>&1 | reduceapt | tee /dev/stderr)" if [ $? != 0 ];then echo "$output" | apt_diagnose error "pkg_install: While installing local packages, $package failed to install." fi - sudo apt-mark auto "$packagename" || error "pkg-install: failed to mark the $packagename package as autoremovable.\nlocal package path: $package" + sudo -E apt-mark auto "$packagename" || error "pkg-install: failed to mark the $packagename package as autoremovable.\nlocal package path: $package" fi @@ -244,17 +244,17 @@ fi #ensure dummy deb isn't already installed if dpkg -l pi-apps-$appnamehash &>/dev/null ;then echo -e "\e[97m\nDummy deb is already installed. Uninstalling it first...\e[39m" - output="$(sudo apt purge -y pi-apps-$appnamehash 2>&1 | reduceapt | tee /dev/stderr )" + output="$(sudo -E apt purge -y pi-apps-$appnamehash 2>&1 | reduceapt | tee /dev/stderr )" if [ $? != 0 ];then echo "$output" | apt_diagnose error "Failed to purge dummy deb (pi-apps-$appnamehash)" fi - #sudo apt update &>/dev/null + #sudo -E apt update &>/dev/null fi apt_lock_wait echo -e "\e[97m\nInstalling dummy deb...\e[39m" -output="$(sudo apt-get install -y --no-install-recommends ~/pi-apps-$appnamehash.deb 2>&1 | reduceapt | tee /dev/stderr )" +output="$(sudo -E apt-get install -y --no-install-recommends ~/pi-apps-$appnamehash.deb 2>&1 | reduceapt | tee /dev/stderr )" rm -f ~/pi-apps-$appnamehash.deb rm -rf ~/pi-apps-$appnamehash