diff --git a/turnserver_install.sh.sample b/turnserver_install.sh.sample index cc3d634..e00d2de 100644 --- a/turnserver_install.sh.sample +++ b/turnserver_install.sh.sample @@ -20,6 +20,13 @@ setup_permissions() { chmod 600 /etc/coturn/certs/*.pem } +wait_for_apt() { + while fuser /var/lib/dpkg/lock >/dev/null 2>&1 || fuser /var/lib/apt/lists/lock >/dev/null 2>&1 || fuser /var/cache/apt/archives/lock >/dev/null 2>&1 || fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1; do + echo "Waiting for other apt processes to finish..." + sleep 5 + done +} + configure_ssl() { local DOMAIN=$1 @@ -32,6 +39,8 @@ configure_ssl() { # Install certbot if needed if ! command -v certbot >/dev/null; then + echo "Installing certbot..." + wait_for_apt apt-get install certbot -y fi @@ -207,4 +216,4 @@ echo "STUN/TURN ports: 3478 (default)" if [ "${ENABLE_SSL,,}" = "y" ]; then echo "TLS enabled on port 443" echo "SSL certificates will automatically renew via certbot" -fi \ No newline at end of file +fi