mirror of
https://github.com/thelittlerocket/pve.git
synced 2025-03-04 01:38:12 +08:00
update
This commit is contained in:
parent
9bc2e8813f
commit
46256c29f2
1 changed files with 43 additions and 38 deletions
|
@ -285,38 +285,13 @@ if ! grep -q "^deb.*pve-no-subscription" /etc/apt/sources.list; then
|
|||
echo "$repo_url" >> /etc/apt/sources.list
|
||||
fi
|
||||
|
||||
# 下载pve
|
||||
apt-get update -y && apt-get full-upgrade -y
|
||||
if [ $? -ne 0 ]; then
|
||||
apt-get install debian-keyring debian-archive-keyring -y
|
||||
apt-get update -y && apt-get full-upgrade -y
|
||||
fi
|
||||
apt_update_output=$(apt-get update 2>&1)
|
||||
echo "$apt_update_output" > "$temp_file_apt_fix"
|
||||
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"
|
||||
output=$(apt-get update 2>&1)
|
||||
if echo $output | grep -q "NO_PUBKEY"; then
|
||||
_yellow "try sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys missing key"
|
||||
exit 1
|
||||
fi
|
||||
install_package proxmox-ve
|
||||
install_package postfix
|
||||
install_package open-iscsi
|
||||
|
||||
# 备份网络设置
|
||||
cp /etc/network/interfaces /etc/network/interfaces.bak
|
||||
cp /etc/network/interfaces.new /etc/network/interfaces.new.bak
|
||||
cp /etc/network/interfaces.d/50-cloud-init /etc/network/interfaces.d/50-cloud-init.bak
|
||||
rebuild_interfaces
|
||||
|
||||
rebuild_interfaces(){
|
||||
# 修复部分网络加载未空
|
||||
if [ ! -e /run/network/interfaces.d/* ]; then
|
||||
if [ -f "/etc/network/interfaces" ];then
|
||||
|
@ -350,6 +325,36 @@ fi
|
|||
remove_duplicate_lines "/etc/network/interfaces"
|
||||
remove_duplicate_lines "/etc/network/interfaces.new"
|
||||
remove_duplicate_lines "/etc/network/interfaces.d/50-cloud-init"
|
||||
}
|
||||
|
||||
# 下载pve
|
||||
apt-get update -y && apt-get full-upgrade -y
|
||||
if [ $? -ne 0 ]; then
|
||||
apt-get install debian-keyring debian-archive-keyring -y
|
||||
apt-get update -y && apt-get full-upgrade -y
|
||||
fi
|
||||
apt_update_output=$(apt-get update 2>&1)
|
||||
echo "$apt_update_output" > "$temp_file_apt_fix"
|
||||
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"
|
||||
output=$(apt-get update 2>&1)
|
||||
if echo $output | grep -q "NO_PUBKEY"; then
|
||||
_yellow "try sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys missing key"
|
||||
exit 1
|
||||
fi
|
||||
install_package proxmox-ve
|
||||
install_package postfix
|
||||
install_package open-iscsi
|
||||
rebuild_interfaces
|
||||
|
||||
# 如果是国内服务器则替换CT源为国内镜像源
|
||||
if [[ -n "${CN}" ]]; then
|
||||
|
|
Loading…
Reference in a new issue