diff --git a/socks5.sh b/socks5.sh index 5eb5d75..a5149a9 100644 --- a/socks5.sh +++ b/socks5.sh @@ -19,6 +19,15 @@ set -e export DEBIAN_FRONTEND=noninteractive +# Wait for unlocking: + wait_for_lock() { + while fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1; do + echo "Waiting for /var/lib/dpkg/lock-frontend to be unlocked..." + sleep 5 + done + } + + echo "Find active network interface..." INTERFACE=$(ip -o -4 route show to default | awk '{print $5}') @@ -30,7 +39,9 @@ fi echo "Active network interface found: $INTERFACE" echo "Install dante-server..." +wait_for_lock apt-get update +wait_for_lock apt-get install -y dante-server echo "Backup existing configuration file $DANTE_CONF..."