pkg-install: use sudo -E

pull/906/head
Botspot 4 years ago
parent 44b463826e
commit c25296eee2

@ -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

Loading…
Cancel
Save