diff --git a/vpnsetup_ubuntu.sh b/vpnsetup_ubuntu.sh index c829a54..e46849b 100755 --- a/vpnsetup_ubuntu.sh +++ b/vpnsetup_ubuntu.sh @@ -139,14 +139,11 @@ fi bigecho "VPN setup in progress... Please be patient." -mkdir -p /opt/src -cd /opt/src || exit 1 - count=0 -APT_LK=/var/lib/apt/lists/lock -PKG_LK=/var/lib/dpkg/lock -while fuser "$APT_LK" "$PKG_LK" >/dev/null 2>&1 \ - || lsof "$APT_LK" >/dev/null 2>&1 || lsof "$PKG_LK" >/dev/null 2>&1; do +apt_lk=/var/lib/apt/lists/lock +pkg_lk=/var/lib/dpkg/lock +while fuser "$apt_lk" "$pkg_lk" >/dev/null 2>&1 \ + || lsof "$apt_lk" >/dev/null 2>&1 || lsof "$pkg_lk" >/dev/null 2>&1; do [ "$count" = "0" ] && bigecho "Waiting for apt to be available..." [ "$count" -ge "100" ] && exiterr "Could not get apt/dpkg lock." count=$((count+1)) @@ -154,6 +151,9 @@ while fuser "$APT_LK" "$PKG_LK" >/dev/null 2>&1 \ sleep 3 done +mkdir -p /opt/src +cd /opt/src || exit 1 + bigecho "Installing packages required for setup..." export DEBIAN_FRONTEND=noninteractive