Update install_pve6.sh

This commit is contained in:
spiritLHLS 2023-02-15 11:21:31 +08:00 committed by GitHub
parent 6baeb89797
commit f0c40ee327
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,6 +26,27 @@ ip=$(curl -s ipv4.ip.sb)
echo "127.0.0.1 localhost.localdomain localhost" | tee -a /etc/hosts echo "127.0.0.1 localhost.localdomain localhost" | tee -a /etc/hosts
echo "${ip} pve.proxmox.com pve" | tee -a /etc/hosts echo "${ip} pve.proxmox.com pve" | tee -a /etc/hosts
## China_IP
if [[ -z "${CN}" ]]; then
if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
_yellow "根据ipapi.co提供的信息当前IP可能在中国"
read -e -r -p "是否选用中国镜像完成安装? [Y/n] " input
case $input in
[yY][eE][sS] | [yY])
echo "使用中国镜像"
CN=true
;;
[nN][oO] | [nN])
echo "不使用中国镜像"
;;
*)
echo "使用中国镜像"
CN=true
;;
esac
fi
fi
# 再次预检查 # 再次预检查
apt-get install gnupg -y apt-get install gnupg -y
if [ $(uname -m) != "x86_64" ] || [ ! -f /etc/debian_version ] || [ $(grep MemTotal /proc/meminfo | awk '{print $2}') -lt 2000000 ] || [ $(grep -c ^processor /proc/cpuinfo) -lt 2 ] || [ $(ping -c 3 google.com > /dev/null 2>&1; echo $?) -ne 0 ]; then if [ $(uname -m) != "x86_64" ] || [ ! -f /etc/debian_version ] || [ $(grep MemTotal /proc/meminfo | awk '{print $2}') -lt 2000000 ] || [ $(grep -c ^processor /proc/cpuinfo) -lt 2 ] || [ $(ping -c 3 google.com > /dev/null 2>&1; echo $?) -ne 0 ]; then
@ -36,19 +57,18 @@ else
fi fi
# 新增pve源 # 新增pve源
version=$(lsb_release -cs) case $(lsb_release -cs) in
if [ "$version" == "jessie" ]; then jessie|stretch|buster|bullseye)
repo_url="deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian/pve jessie pve-no-subscription" repo_url="deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian/pve ${version} pve-no-subscription"
elif [ "$version" == "stretch" ]; then if [[ -n "${CN}" ]]; then
repo_url="deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian/pve stretch pve-no-subscription" repo_url="deb http://download.proxmox.com/debian/pve ${version} pve-no-subscription"
elif [ "$version" == "buster" ]; then fi
repo_url="deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian/pve buster pve-no-subscription" ;;
elif [ "$version" == "bullseye" ]; then *)
repo_url="deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian/pve bullseye pve-no-subscription" _red "Error: Unsupported Debian version"
else exit 1
_red "Error: Unsupported Debian version" ;;
exit 1 esac
fi
wget http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg wget http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg
chmod +r /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg chmod +r /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg
echo "$repo_url" >> /etc/apt/sources.list echo "$repo_url" >> /etc/apt/sources.list