From bb6a7a10f97f0b8214ad797364ef1fb1dee61a36 Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Thu, 22 Jun 2023 06:48:25 +0000 Subject: [PATCH] update --- CHANGELOG.md | 6 ++++++ README.md | 6 ++---- README_EN.md => back/README_EN.md | 0 scripts/install_pve.sh | 18 ++++++++++++------ 4 files changed, 20 insertions(+), 10 deletions(-) rename README_EN.md => back/README_EN.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33ca811..e9c7899 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # 更新日志 +2023.06.21 + +- 增加手动指定IPV4地址的脚本 +- PVE安装修复部分系统原生网络设置有问题的情况 +- 修复NAT网关自动设置时部分机器的物理接口存在别名的情况,已自动识别替换别名 + 2023.06.14 - 修改ssh.sh文件以适配不同的系统启用SSH端口和服务 diff --git a/README.md b/README.md index 13e41c5..a33a0f4 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,9 @@ ## 更新 -2023.06.21 +2023.06.22 -- 增加手动指定IPV4地址的脚本 -- PVE安装修复部分系统原生网络设置有问题的情况 -- 修复NAT网关自动设置时部分机器的物理接口存在别名的情况,已自动识别替换别名 +- PVE安装修复部分机器网络设置不立即重新加载的问题,增加网络设置备份 [更新日志](CHANGELOG.md) diff --git a/README_EN.md b/back/README_EN.md similarity index 100% rename from README_EN.md rename to back/README_EN.md diff --git a/scripts/install_pve.sh b/scripts/install_pve.sh index ce137ca..6726da8 100644 --- a/scripts/install_pve.sh +++ b/scripts/install_pve.sh @@ -51,7 +51,9 @@ rm "$temp_file_apt_fix" remove_duplicate_lines() { # 去除重复行并跳过空行 - awk '!NF || !x[$0]++' "$1" > "$1.tmp" && mv -f "$1.tmp" "$1" + if [ -f "$1" ];then + awk '!NF || !x[$0]++' "$1" > "$1.tmp" && mv -f "$1.tmp" "$1" + fi } install_package() { @@ -59,11 +61,11 @@ install_package() { if command -v $package_name > /dev/null 2>&1 ; then _green "$package_name 已经安装" else - apt-get install -y $package_name - if [ $? -ne 0 ]; then - apt-get install -y $package_name --fix-missing - fi - _green "$package_name 已尝试安装" + apt-get install -y $package_name + if [ $? -ne 0 ]; then + apt-get install -y $package_name --fix-missing + fi + _green "$package_name 已尝试安装" fi } @@ -344,6 +346,10 @@ if [[ -f "/etc/network/interfaces.d/50-cloud-init" && -f "/etc/network/interface chattr +i /etc/network/interfaces.d/50-cloud-init fi fi +# 去除空行之外的重复行 +remove_duplicate_lines "/etc/network/interfaces" +remove_duplicate_lines "/etc/network/interfaces.new" +remove_duplicate_lines "/etc/network/interfaces.d/50-cloud-init" # 如果是国内服务器则替换CT源为国内镜像源 if [[ -n "${CN}" ]]; then