diff --git a/extras/quickstart.sh b/extras/quickstart.sh index e9d6092..2407940 100755 --- a/extras/quickstart.sh +++ b/extras/quickstart.sh @@ -253,7 +253,8 @@ install_pkgs() { } get_setup_url() { - base_url="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master" + base_url1="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master" + base_url2="https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master" sh_file="vpnsetup_ubuntu.sh" if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ] || [ "$os_type" = "rocky" ] \ || [ "$os_type" = "alma" ] || [ "$os_type" = "ol" ]; then @@ -263,14 +264,16 @@ get_setup_url() { elif [ "$os_type" = "alpine" ]; then sh_file="vpnsetup_alpine.sh" fi - setup_url="$base_url/$sh_file" + setup_url1="$base_url1/$sh_file" + setup_url2="$base_url2/$sh_file" } run_setup() { status=0 if tmpdir=$(mktemp --tmpdir -d vpn.XXXXX 2>/dev/null); then - if ( set -x; wget -t 3 -T 30 -q -O "$tmpdir/vpn.sh" "$setup_url" \ - || curl -fsL "$setup_url" -o "$tmpdir/vpn.sh" 2>/dev/null ); then + if ( set -x; wget -t 3 -T 30 -q -O "$tmpdir/vpn.sh" "$setup_url1" \ + || wget -t 3 -T 30 -q -O "$tmpdir/vpn.sh" "$setup_url2" \ + || curl -fsL "$setup_url1" -o "$tmpdir/vpn.sh" 2>/dev/null ); then VPN_IPSEC_PSK="$VPN_IPSEC_PSK" VPN_USER="$VPN_USER" VPN_PASSWORD="$VPN_PASSWORD" \ VPN_PUBLIC_IP="$VPN_PUBLIC_IP" VPN_L2TP_NET="$VPN_L2TP_NET" \ VPN_L2TP_LOCAL="$VPN_L2TP_LOCAL" VPN_L2TP_POOL="$VPN_L2TP_POOL" \ diff --git a/extras/vpnupgrade.sh b/extras/vpnupgrade.sh index 8ce5589..d2e39c9 100755 --- a/extras/vpnupgrade.sh +++ b/extras/vpnupgrade.sh @@ -134,7 +134,8 @@ install_pkgs() { } get_setup_url() { - base_url="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" + base_url1="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" + base_url2="https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master/extras" sh_file="vpnupgrade_ubuntu.sh" if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ] || [ "$os_type" = "rocky" ] \ || [ "$os_type" = "alma" ] || [ "$os_type" = "ol" ]; then @@ -144,14 +145,16 @@ get_setup_url() { elif [ "$os_type" = "alpine" ]; then sh_file="vpnupgrade_alpine.sh" fi - setup_url="$base_url/$sh_file" + setup_url1="$base_url1/$sh_file" + setup_url2="$base_url2/$sh_file" } run_setup() { status=0 if tmpdir=$(mktemp --tmpdir -d vpn.XXXXX 2>/dev/null); then - if ( set -x; wget -t 3 -T 30 -q -O "$tmpdir/vpnup.sh" "$setup_url" \ - || curl -fsL "$setup_url" -o "$tmpdir/vpnup.sh" 2>/dev/null ); then + if ( set -x; wget -t 3 -T 30 -q -O "$tmpdir/vpnup.sh" "$setup_url1" \ + || wget -t 3 -T 30 -q -O "$tmpdir/vpnup.sh" "$setup_url2" \ + || curl -fsL "$setup_url1" -o "$tmpdir/vpnup.sh" 2>/dev/null ); then VPN_UPDATE_SWAN_VER="$SWAN_VER" /bin/bash "$tmpdir/vpnup.sh" || status=1 else status=1 diff --git a/vpnsetup.sh b/vpnsetup.sh index 04da4f7..5f3d165 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -253,7 +253,8 @@ install_pkgs() { } get_setup_url() { - base_url="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master" + base_url1="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master" + base_url2="https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master" sh_file="vpnsetup_ubuntu.sh" if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ] || [ "$os_type" = "rocky" ] \ || [ "$os_type" = "alma" ] || [ "$os_type" = "ol" ]; then @@ -263,14 +264,16 @@ get_setup_url() { elif [ "$os_type" = "alpine" ]; then sh_file="vpnsetup_alpine.sh" fi - setup_url="$base_url/$sh_file" + setup_url1="$base_url1/$sh_file" + setup_url2="$base_url2/$sh_file" } run_setup() { status=0 if tmpdir=$(mktemp --tmpdir -d vpn.XXXXX 2>/dev/null); then - if ( set -x; wget -t 3 -T 30 -q -O "$tmpdir/vpn.sh" "$setup_url" \ - || curl -fsL "$setup_url" -o "$tmpdir/vpn.sh" 2>/dev/null ); then + if ( set -x; wget -t 3 -T 30 -q -O "$tmpdir/vpn.sh" "$setup_url1" \ + || wget -t 3 -T 30 -q -O "$tmpdir/vpn.sh" "$setup_url2" \ + || curl -fsL "$setup_url1" -o "$tmpdir/vpn.sh" 2>/dev/null ); then VPN_IPSEC_PSK="$VPN_IPSEC_PSK" VPN_USER="$VPN_USER" VPN_PASSWORD="$VPN_PASSWORD" \ VPN_PUBLIC_IP="$VPN_PUBLIC_IP" VPN_L2TP_NET="$VPN_L2TP_NET" \ VPN_L2TP_LOCAL="$VPN_L2TP_LOCAL" VPN_L2TP_POOL="$VPN_L2TP_POOL" \ diff --git a/vpnsetup_alpine.sh b/vpnsetup_alpine.sh index 1f710c1..ee0068c 100755 --- a/vpnsetup_alpine.sh +++ b/vpnsetup_alpine.sh @@ -193,18 +193,23 @@ install_fail2ban() { get_helper_scripts() { bigecho "Downloading helper scripts..." - base_url="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" - ikev2_url="$base_url/ikev2setup.sh" - add_url="$base_url/add_vpn_user.sh" - del_url="$base_url/del_vpn_user.sh" + base_url1="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" + base_url2="https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master/extras" + ikev2_url1="$base_url1/ikev2setup.sh" + ikev2_url2="$base_url2/ikev2setup.sh" + add_url1="$base_url1/add_vpn_user.sh" + add_url2="$base_url2/add_vpn_user.sh" + del_url1="$base_url1/del_vpn_user.sh" + del_url2="$base_url2/del_vpn_user.sh" cd /opt/src || exit 1 printf '%s' "+ " for sc in ikev2.sh addvpnuser.sh delvpnuser.sh; do - [ "$sc" = "ikev2.sh" ] && dl_url="$ikev2_url" - [ "$sc" = "addvpnuser.sh" ] && dl_url="$add_url" - [ "$sc" = "delvpnuser.sh" ] && dl_url="$del_url" + [ "$sc" = "ikev2.sh" ] && dl_url1="$ikev2_url1" && dl_url2="$ikev2_url2" + [ "$sc" = "addvpnuser.sh" ] && dl_url1="$add_url1" && dl_url2="$add_url2" + [ "$sc" = "delvpnuser.sh" ] && dl_url1="$del_url1" && dl_url2="$del_url2" printf '%s' "$sc " - wget -t 3 -T 30 -q -O "$sc" "$dl_url" || /bin/rm -f "$sc" + wget -t 3 -T 30 -q -O "$sc" "$dl_url1" \ + || wget -t 3 -T 30 -q -O "$sc" "$dl_url2" || /bin/rm -f "$sc" [ -s "$sc" ] && chmod +x "$sc" && ln -s "/opt/src/$sc" /usr/bin 2>/dev/null done echo diff --git a/vpnsetup_amzn.sh b/vpnsetup_amzn.sh index b2fe6e7..cc01774 100755 --- a/vpnsetup_amzn.sh +++ b/vpnsetup_amzn.sh @@ -193,18 +193,23 @@ install_fail2ban() { get_helper_scripts() { bigecho "Downloading helper scripts..." - base_url="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" - ikev2_url="$base_url/ikev2setup.sh" - add_url="$base_url/add_vpn_user.sh" - del_url="$base_url/del_vpn_user.sh" + base_url1="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" + base_url2="https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master/extras" + ikev2_url1="$base_url1/ikev2setup.sh" + ikev2_url2="$base_url2/ikev2setup.sh" + add_url1="$base_url1/add_vpn_user.sh" + add_url2="$base_url2/add_vpn_user.sh" + del_url1="$base_url1/del_vpn_user.sh" + del_url2="$base_url2/del_vpn_user.sh" cd /opt/src || exit 1 printf '%s' "+ " for sc in ikev2.sh addvpnuser.sh delvpnuser.sh; do - [ "$sc" = "ikev2.sh" ] && dl_url="$ikev2_url" - [ "$sc" = "addvpnuser.sh" ] && dl_url="$add_url" - [ "$sc" = "delvpnuser.sh" ] && dl_url="$del_url" + [ "$sc" = "ikev2.sh" ] && dl_url1="$ikev2_url1" && dl_url2="$ikev2_url2" + [ "$sc" = "addvpnuser.sh" ] && dl_url1="$add_url1" && dl_url2="$add_url2" + [ "$sc" = "delvpnuser.sh" ] && dl_url1="$del_url1" && dl_url2="$del_url2" printf '%s' "$sc " - wget -t 3 -T 30 -q -O "$sc" "$dl_url" || /bin/rm -f "$sc" + wget -t 3 -T 30 -q -O "$sc" "$dl_url1" \ + || wget -t 3 -T 30 -q -O "$sc" "$dl_url2" || /bin/rm -f "$sc" [ -s "$sc" ] && chmod +x "$sc" && ln -s "/opt/src/$sc" /usr/bin 2>/dev/null done echo diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index dec0b46..787fb11 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -264,18 +264,23 @@ install_fail2ban() { get_helper_scripts() { bigecho "Downloading helper scripts..." - base_url="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" - ikev2_url="$base_url/ikev2setup.sh" - add_url="$base_url/add_vpn_user.sh" - del_url="$base_url/del_vpn_user.sh" + base_url1="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" + base_url2="https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master/extras" + ikev2_url1="$base_url1/ikev2setup.sh" + ikev2_url2="$base_url2/ikev2setup.sh" + add_url1="$base_url1/add_vpn_user.sh" + add_url2="$base_url2/add_vpn_user.sh" + del_url1="$base_url1/del_vpn_user.sh" + del_url2="$base_url2/del_vpn_user.sh" cd /opt/src || exit 1 printf '%s' "+ " for sc in ikev2.sh addvpnuser.sh delvpnuser.sh; do - [ "$sc" = "ikev2.sh" ] && dl_url="$ikev2_url" - [ "$sc" = "addvpnuser.sh" ] && dl_url="$add_url" - [ "$sc" = "delvpnuser.sh" ] && dl_url="$del_url" + [ "$sc" = "ikev2.sh" ] && dl_url1="$ikev2_url1" && dl_url2="$ikev2_url2" + [ "$sc" = "addvpnuser.sh" ] && dl_url1="$add_url1" && dl_url2="$add_url2" + [ "$sc" = "delvpnuser.sh" ] && dl_url1="$del_url1" && dl_url2="$del_url2" printf '%s' "$sc " - wget -t 3 -T 30 -q -O "$sc" "$dl_url" || /bin/rm -f "$sc" + wget -t 3 -T 30 -q -O "$sc" "$dl_url1" \ + || wget -t 3 -T 30 -q -O "$sc" "$dl_url2" || /bin/rm -f "$sc" [ -s "$sc" ] && chmod +x "$sc" && ln -s "/opt/src/$sc" /usr/bin 2>/dev/null done echo diff --git a/vpnsetup_ubuntu.sh b/vpnsetup_ubuntu.sh index 726b80e..fd73cd4 100755 --- a/vpnsetup_ubuntu.sh +++ b/vpnsetup_ubuntu.sh @@ -233,18 +233,23 @@ install_fail2ban() { get_helper_scripts() { bigecho "Downloading helper scripts..." - base_url="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" - ikev2_url="$base_url/ikev2setup.sh" - add_url="$base_url/add_vpn_user.sh" - del_url="$base_url/del_vpn_user.sh" + base_url1="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" + base_url2="https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master/extras" + ikev2_url1="$base_url1/ikev2setup.sh" + ikev2_url2="$base_url2/ikev2setup.sh" + add_url1="$base_url1/add_vpn_user.sh" + add_url2="$base_url2/add_vpn_user.sh" + del_url1="$base_url1/del_vpn_user.sh" + del_url2="$base_url2/del_vpn_user.sh" cd /opt/src || exit 1 printf '%s' "+ " for sc in ikev2.sh addvpnuser.sh delvpnuser.sh; do - [ "$sc" = "ikev2.sh" ] && dl_url="$ikev2_url" - [ "$sc" = "addvpnuser.sh" ] && dl_url="$add_url" - [ "$sc" = "delvpnuser.sh" ] && dl_url="$del_url" + [ "$sc" = "ikev2.sh" ] && dl_url1="$ikev2_url1" && dl_url2="$ikev2_url2" + [ "$sc" = "addvpnuser.sh" ] && dl_url1="$add_url1" && dl_url2="$add_url2" + [ "$sc" = "delvpnuser.sh" ] && dl_url1="$del_url1" && dl_url2="$del_url2" printf '%s' "$sc " - wget -t 3 -T 30 -q -O "$sc" "$dl_url" || /bin/rm -f "$sc" + wget -t 3 -T 30 -q -O "$sc" "$dl_url1" \ + || wget -t 3 -T 30 -q -O "$sc" "$dl_url2" || /bin/rm -f "$sc" [ -s "$sc" ] && chmod +x "$sc" && ln -s "/opt/src/$sc" /usr/bin 2>/dev/null done echo