mirror of
https://github.com/thelittlerocket/pve.git
synced 2024-11-15 19:44:38 +08:00
Update install_pve.sh
This commit is contained in:
parent
c47aa6fa38
commit
fc48d3957e
1 changed files with 15 additions and 5 deletions
|
@ -32,10 +32,20 @@ fi
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
apt-get install gnupg -y
|
apt-get install gnupg -y
|
||||||
fi
|
fi
|
||||||
output=$(apt-get update 2>&1)
|
if command -v apt-get > /dev/null 2>&1; then
|
||||||
if echo $output | grep -q "NO_PUBKEY"; then
|
apt_update_output=$(apt-get update 2>&1)
|
||||||
_yellow "try “ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys missing key ” to fix"
|
echo "$apt_update_output" > "$temp_file_apt_fix"
|
||||||
exit 1
|
if grep -q 'NO_PUBKEY' "$temp_file_apt_fix"; then
|
||||||
|
public_keys=$(grep -oE 'NO_PUBKEY [0-9A-F]+' "$temp_file_apt_fix" | awk '{ print $2 }')
|
||||||
|
joined_keys=$(echo "$public_keys" | paste -sd " ")
|
||||||
|
_yellow "No Public Keys: ${joined_keys}"
|
||||||
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ${joined_keys}
|
||||||
|
apt-get update
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
_green "Fixed"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
rm "$temp_file_apt_fix"
|
||||||
fi
|
fi
|
||||||
if ! command -v wget > /dev/null 2>&1; then
|
if ! command -v wget > /dev/null 2>&1; then
|
||||||
apt-get install -y wget
|
apt-get install -y wget
|
||||||
|
|
Loading…
Reference in a new issue