From 9f674ffaeb575604e95253f7e61586401255e8dc Mon Sep 17 00:00:00 2001 From: spiritLHLS <103393591+spiritLHLS@users.noreply.github.com> Date: Mon, 13 Feb 2023 19:46:15 +0800 Subject: [PATCH] Update install_pve7.sh --- install_pve7.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/install_pve7.sh b/install_pve7.sh index e45d7f5..d77623d 100644 --- a/install_pve7.sh +++ b/install_pve7.sh @@ -14,7 +14,17 @@ if ! command -v curl > /dev/null 2>&1; then apt-get install -y curl fi curl -L https://raw.githubusercontent.com/spiritLHLS/one-click-installation-script/main/check_sudo.sh -o check_sudo.sh && chmod +x check_sudo.sh && bash check_sudo.sh > /dev/null 2>&1 -sed -i 's/precedence ::ffff:0:0\/96 100/precedence ::ffff:0:0\/96 40/g' /etc/gai.conf +ip_type=$(curl -s ip.sb | grep -oP '(?<=is )(.+)(?=\.)') +if [ -z "$ip_type" ]; then + echo "Error: curl request failed" + exit 1 +fi +if [ "$ip_type" != "IPv4" ]; then + priority=$(grep precedence /etc/gai.conf | grep -oP '(?<=precedence ::/0 )\d+') +fi +if [ "$ip_type" = "IPv6" ] && [ "$priority" -lt "100" ]; then + echo "precedence ::/0 100" > /etc/gai.conf +fi # sysctl -w net.ipv6.conf.all.disable_ipv6=1 # sysctl -w net.ipv6.conf.default.disable_ipv6=1 apt-get install gnupg -y