pkg-install: auto-sign unsigned repos and fix check for --fix-broken

pull/884/head
Botspot 3 years ago
parent beea61e93a
commit 4b8f88b4c6

@ -54,7 +54,7 @@ if [ $exitcode != 0 ] || [ ! -z "$errors" ];then
echo -e "APT reported these errors:\n\e[91m$errors\e[39m"
#run some apt error diagnosis
if echo "$errors" | grep -q 'E: The repository' ;then
if echo "$errors" | grep -q 'E: The repository';then
echo -e "\e[93m
--------------------------------------------------------------------------------
APT reported a faulty repository, and you must fix it before Pi-Apps will work.
@ -67,6 +67,15 @@ sources.list requires root permissions to edit: sudo mousepad /path/to/file
--------------------------------------------------------------------------------
\e[39m"
fi
if echo "$errors" | grep -q 'NO_PUBKEY';then
echo -en "\e[93m
APT reported an unsigned repository. This script will try to repair it.
Press Ctrl+C in 5 seconds to cancel...\e[39m"
sleep 5
echo -e '\n\e[93mAutomatically signing 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
echo -e '\e[93mDone. Please try installing the same app again.\e[39m'
fi
exit 1
fi
@ -171,7 +180,7 @@ if [ ! -z "$errors" ];then
echo -e "APT reported these errors:\n\e[91m$errors\e[39m"
#run some apt error diagnosis
if echo "$errors" | grep -q "--fix-broken" ;then
if echo "$errors" | grep -q "\-\-fix\-broken" ;then
echo -e "\e[93m
--------------------------------------------------------------------------------
APT reported a broken package, and you must fix it before Pi-Apps will work.

Loading…
Cancel
Save