diff --git a/vpnsetup_alpine.sh b/vpnsetup_alpine.sh index 14e175b..8f54c93 100755 --- a/vpnsetup_alpine.sh +++ b/vpnsetup_alpine.sh @@ -210,23 +210,20 @@ install_fail2ban() { get_helper_scripts() { bigecho "Downloading helper scripts..." - 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" + base1="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" + base2="https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master/extras" cd /opt/src || exit 1 printf '%s' "+ " for sc in ikev2.sh addvpnuser.sh delvpnuser.sh; do - [ "$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" + [ "$sc" = "ikev2.sh" ] && dl1="$base1/ikev2setup.sh" \ + && dl2="$base2/ikev2setup.sh" + [ "$sc" = "addvpnuser.sh" ] && dl1="$base1/add_vpn_user.sh" \ + && dl2="$base2/add_vpn_user.sh" + [ "$sc" = "delvpnuser.sh" ] && dl1="$base1/del_vpn_user.sh" \ + && dl2="$base2/del_vpn_user.sh" printf '%s' "$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" + wget -t 3 -T 30 -q -O "$sc" "$dl1" || wget -t 3 -T 30 -q -O "$sc" "$dl2" \ + || /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 5b7e416..b598636 100755 --- a/vpnsetup_amzn.sh +++ b/vpnsetup_amzn.sh @@ -224,23 +224,20 @@ install_fail2ban() { get_helper_scripts() { bigecho "Downloading helper scripts..." - 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" + base1="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" + base2="https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master/extras" cd /opt/src || exit 1 printf '%s' "+ " for sc in ikev2.sh addvpnuser.sh delvpnuser.sh; do - [ "$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" + [ "$sc" = "ikev2.sh" ] && dl1="$base1/ikev2setup.sh" \ + && dl2="$base2/ikev2setup.sh" + [ "$sc" = "addvpnuser.sh" ] && dl1="$base1/add_vpn_user.sh" \ + && dl2="$base2/add_vpn_user.sh" + [ "$sc" = "delvpnuser.sh" ] && dl1="$base1/del_vpn_user.sh" \ + && dl2="$base2/del_vpn_user.sh" printf '%s' "$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" + wget -t 3 -T 30 -q -O "$sc" "$dl1" || wget -t 3 -T 30 -q -O "$sc" "$dl2" \ + || /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 5f3a091..1915505 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -330,23 +330,20 @@ install_fail2ban() { get_helper_scripts() { bigecho "Downloading helper scripts..." - 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" + base1="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" + base2="https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master/extras" cd /opt/src || exit 1 printf '%s' "+ " for sc in ikev2.sh addvpnuser.sh delvpnuser.sh; do - [ "$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" + [ "$sc" = "ikev2.sh" ] && dl1="$base1/ikev2setup.sh" \ + && dl2="$base2/ikev2setup.sh" + [ "$sc" = "addvpnuser.sh" ] && dl1="$base1/add_vpn_user.sh" \ + && dl2="$base2/add_vpn_user.sh" + [ "$sc" = "delvpnuser.sh" ] && dl1="$base1/del_vpn_user.sh" \ + && dl2="$base2/del_vpn_user.sh" printf '%s' "$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" + wget -t 3 -T 30 -q -O "$sc" "$dl1" || wget -t 3 -T 30 -q -O "$sc" "$dl2" \ + || /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 b749115..91a0ae0 100755 --- a/vpnsetup_ubuntu.sh +++ b/vpnsetup_ubuntu.sh @@ -270,23 +270,20 @@ install_fail2ban() { get_helper_scripts() { bigecho "Downloading helper scripts..." - 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" + base1="https://github.com/hwdsl2/setup-ipsec-vpn/raw/master/extras" + base2="https://gitlab.com/hwdsl2/setup-ipsec-vpn/-/raw/master/extras" cd /opt/src || exit 1 printf '%s' "+ " for sc in ikev2.sh addvpnuser.sh delvpnuser.sh; do - [ "$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" + [ "$sc" = "ikev2.sh" ] && dl1="$base1/ikev2setup.sh" \ + && dl2="$base2/ikev2setup.sh" + [ "$sc" = "addvpnuser.sh" ] && dl1="$base1/add_vpn_user.sh" \ + && dl2="$base2/add_vpn_user.sh" + [ "$sc" = "delvpnuser.sh" ] && dl1="$base1/del_vpn_user.sh" \ + && dl2="$base2/del_vpn_user.sh" printf '%s' "$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" + wget -t 3 -T 30 -q -O "$sc" "$dl1" || wget -t 3 -T 30 -q -O "$sc" "$dl2" \ + || /bin/rm -f "$sc" [ -s "$sc" ] && chmod +x "$sc" && ln -s "/opt/src/$sc" /usr/bin 2>/dev/null done echo