mirror of
https://github.com/oneclickvirt/pve.git
synced 2024-11-10 17:25:50 +08:00
2023.07.31
This commit is contained in:
parent
53335a754c
commit
c2caaff559
2 changed files with 58 additions and 1 deletions
|
@ -15,11 +15,12 @@
|
|||
|
||||
2023.07.31
|
||||
|
||||
- 修复部分机器重启机器后失联的情况
|
||||
- 修复部分机器重启机器后失联的情况(Hetzner、Azure)
|
||||
- 增加自动时间校准功能
|
||||
- 加速系统熵计算
|
||||
- 修复创建虚拟机和容器的一键脚本分别适配ARM和X86_64的情况
|
||||
- 重构物理接口检测函数,保证检测到的接口顺序与```ip addr show```一致
|
||||
- 优化ssh.sh文件,如果开设debian的LXC容器时,遇到中国宿主机,对应自动替换apt源
|
||||
|
||||
[更新日志](CHANGELOG.md)
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# from
|
||||
# https://github.com/spiritLHLS/pve
|
||||
# 2023.07.31
|
||||
|
||||
if [ -f "/etc/resolv.conf" ]
|
||||
then
|
||||
|
@ -39,6 +40,55 @@ else
|
|||
echo "Locale set to $utf8_locale"
|
||||
fi
|
||||
|
||||
check_china(){
|
||||
echo "IP area being detected ......"
|
||||
if [[ -z "${CN}" ]]; then
|
||||
if [[ $(curl -m 6 -s https://ipapi.co/json | grep 'China') != "" ]]; then
|
||||
echo "根据ipapi.co提供的信息,当前IP可能在中国"
|
||||
CN=true
|
||||
else
|
||||
if [[ $? -ne 0 ]]; then
|
||||
if [[ $(curl -m 6 -s cip.cc) =~ "中国" ]]; then
|
||||
echo "根据cip.cc提供的信息,当前IP可能在中国"
|
||||
CN=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
change_debian_apt_sources() {
|
||||
cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
||||
echo "backup the current /etc/apt/sources.list to /etc/apt/sources.list.bak"
|
||||
DEBIAN_VERSION=$(lsb_release -sr)
|
||||
if [[ -z "${CN}" || "${CN}" != true ]]; then
|
||||
URL="http://deb.debian.org/debian"
|
||||
else
|
||||
# Use mirrors.aliyun.com sources list if IP is in China
|
||||
URL="http://mirrors.aliyun.com/debian"
|
||||
fi
|
||||
|
||||
case $DEBIAN_VERSION in
|
||||
6*) DEBIAN_RELEASE="squeeze";;
|
||||
7*) DEBIAN_RELEASE="wheezy";;
|
||||
8*) DEBIAN_RELEASE="jessie";;
|
||||
9*) DEBIAN_RELEASE="stretch";;
|
||||
10*) DEBIAN_RELEASE="buster";;
|
||||
11*) DEBIAN_RELEASE="bullseye";;
|
||||
12*) DEBIAN_RELEASE="bookworm";;
|
||||
*) echo "The system is not Debian 6/7/8/9/10/11/12 . No changes were made to the apt-get sources." && return 1;;
|
||||
esac
|
||||
|
||||
cat > /etc/apt/sources.list <<EOF
|
||||
deb ${URL} ${DEBIAN_RELEASE} main contrib non-free
|
||||
deb ${URL} ${DEBIAN_RELEASE}-updates main contrib non-free
|
||||
deb ${URL} ${DEBIAN_RELEASE}-backports main contrib non-free
|
||||
deb-src ${URL} ${DEBIAN_RELEASE} main contrib non-free
|
||||
deb-src ${URL} ${DEBIAN_RELEASE}-updates main contrib non-free
|
||||
deb-src ${URL} ${DEBIAN_RELEASE}-backports main contrib non-free
|
||||
EOF
|
||||
}
|
||||
|
||||
checkupdate(){
|
||||
if command -v apt-get > /dev/null 2>&1; then
|
||||
apt_update_output=$(apt-get update 2>&1)
|
||||
|
@ -84,6 +134,12 @@ remove_duplicate_lines() {
|
|||
awk '!NF || !x[$0]++' "$1" > "$1.tmp" && mv -f "$1.tmp" "$1"
|
||||
}
|
||||
|
||||
check_china
|
||||
if [[ "${CN}" == true ]]; then
|
||||
if [[ "${SYSTEM}" == "Debian" ]]; then
|
||||
change_debian_apt_sources
|
||||
fi
|
||||
fi
|
||||
checkupdate
|
||||
install_required_modules
|
||||
if [ -f "/etc/motd" ]; then
|
||||
|
|
Loading…
Reference in a new issue