From 86d4f2f93cb623a85e96bc7a4d8d5a37f9c744b7 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Tue, 8 Feb 2022 23:24:46 -0600 Subject: [PATCH] Improve VPN setup - Retry certain 'apt-get' and 'yum' commands on failure --- extras/ikev2setup.sh | 4 ++-- extras/quickstart.sh | 6 +++--- extras/vpnupgrade.sh | 6 +++--- extras/vpnupgrade_ubuntu.sh | 2 +- vpnsetup.sh | 6 +++--- vpnsetup_centos.sh | 2 ++ vpnsetup_ubuntu.sh | 4 +++- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/extras/ikev2setup.sh b/extras/ikev2setup.sh index c4448b1..f6522f3 100755 --- a/extras/ikev2setup.sh +++ b/extras/ikev2setup.sh @@ -686,7 +686,7 @@ install_base64_uuidgen() { bigecho2 "Installing required packages..." if [ "$os_type" = "ubuntu" ] || [ "$os_type" = "debian" ] || [ "$os_type" = "raspbian" ]; then export DEBIAN_FRONTEND=noninteractive - apt-get -yqq update || exiterr "'apt-get update' failed." + apt-get -yqq update || apt-get -yqq update || exiterr "'apt-get update' failed." fi fi if ! command -v base64 >/dev/null 2>&1; then @@ -1018,7 +1018,7 @@ apply_ubuntu1804_nss_fix() { if wget -t 3 -T 30 -q -O "$tmpdir/1.deb" "$nss_url1/$nss_deb1" \ && wget -t 3 -T 30 -q -O "$tmpdir/2.deb" "$nss_url1/$nss_deb2" \ && wget -t 3 -T 30 -q -O "$tmpdir/3.deb" "$nss_url2/$nss_deb3"; then - apt-get -yqq update + apt-get -yqq update || apt-get -yqq update apt-get -yqq install "$tmpdir/1.deb" "$tmpdir/2.deb" "$tmpdir/3.deb" >/dev/null fi /bin/rm -f "$tmpdir/1.deb" "$tmpdir/2.deb" "$tmpdir/3.deb" diff --git a/extras/quickstart.sh b/extras/quickstart.sh index bf5d680..b49d90d 100755 --- a/extras/quickstart.sh +++ b/extras/quickstart.sh @@ -153,16 +153,16 @@ install_pkgs() { export DEBIAN_FRONTEND=noninteractive ( set -x - apt-get -yqq update + apt-get -yqq update || apt-get -yqq update ) || exiterr "'apt-get update' failed." ( set -x - apt-get -yqq install wget >/dev/null + apt-get -yqq install wget >/dev/null || apt-get -yqq install wget >/dev/null ) || exiterr "'apt-get install wget' failed." elif [ "$os_type" != "alpine" ]; then ( set -x - yum -y -q install wget >/dev/null + yum -y -q install wget >/dev/null || yum -y -q install wget >/dev/null ) || exiterr "'yum install wget' failed." fi fi diff --git a/extras/vpnupgrade.sh b/extras/vpnupgrade.sh index 0bee9df..74e17fe 100755 --- a/extras/vpnupgrade.sh +++ b/extras/vpnupgrade.sh @@ -108,16 +108,16 @@ install_pkgs() { export DEBIAN_FRONTEND=noninteractive ( set -x - apt-get -yqq update + apt-get -yqq update || apt-get -yqq update ) || exiterr "'apt-get update' failed." ( set -x - apt-get -yqq install wget >/dev/null + apt-get -yqq install wget >/dev/null || apt-get -yqq install wget >/dev/null ) || exiterr "'apt-get install wget' failed." elif [ "$os_type" != "alpine" ]; then ( set -x - yum -y -q install wget >/dev/null + yum -y -q install wget >/dev/null || yum -y -q install wget >/dev/null ) || exiterr "'yum install wget' failed." fi fi diff --git a/extras/vpnupgrade_ubuntu.sh b/extras/vpnupgrade_ubuntu.sh index dbd9188..36fb354 100755 --- a/extras/vpnupgrade_ubuntu.sh +++ b/extras/vpnupgrade_ubuntu.sh @@ -157,7 +157,7 @@ update_apt_cache() { export DEBIAN_FRONTEND=noninteractive ( set -x - apt-get -yqq update + apt-get -yqq update || apt-get -yqq update ) || exiterr "'apt-get update' failed." } diff --git a/vpnsetup.sh b/vpnsetup.sh index 3b3393b..f80bbba 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -206,16 +206,16 @@ install_pkgs() { export DEBIAN_FRONTEND=noninteractive ( set -x - apt-get -yqq update + apt-get -yqq update || apt-get -yqq update ) || exiterr "'apt-get update' failed." ( set -x - apt-get -yqq install wget >/dev/null + apt-get -yqq install wget >/dev/null || apt-get -yqq install wget >/dev/null ) || exiterr "'apt-get install wget' failed." elif [ "$os_type" != "alpine" ]; then ( set -x - yum -y -q install wget >/dev/null + yum -y -q install wget >/dev/null || yum -y -q install wget >/dev/null ) || exiterr "'yum install wget' failed." fi fi diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index 37c2a12..865caf4 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -143,6 +143,8 @@ install_setup_pkgs() { ( set -x yum -y -q install wget bind-utils openssl tar \ + iptables iproute gawk grep sed net-tools >/dev/null \ + || yum -y -q install wget bind-utils openssl tar \ iptables iproute gawk grep sed net-tools >/dev/null ) || exiterr2 } diff --git a/vpnsetup_ubuntu.sh b/vpnsetup_ubuntu.sh index 4566b75..345b7ed 100755 --- a/vpnsetup_ubuntu.sh +++ b/vpnsetup_ubuntu.sh @@ -169,7 +169,7 @@ update_apt_cache() { export DEBIAN_FRONTEND=noninteractive ( set -x - apt-get -yqq update + apt-get -yqq update || apt-get -yqq update ) || exiterr "'apt-get update' failed." } @@ -177,6 +177,8 @@ install_setup_pkgs() { ( set -x apt-get -yqq install wget dnsutils openssl \ + iptables iproute2 gawk grep sed net-tools >/dev/null \ + || apt-get -yqq install wget dnsutils openssl \ iptables iproute2 gawk grep sed net-tools >/dev/null ) || exiterr2 }