v2.4.6: universal apt_lock_wait helper (fix nginx install on fresh VPS)

- lib/common.sh: add apt_lock_wait + apt_install + apt_update helpers
  * waits up to 300s for dpkg lock held by unattended-upgrades
  * uses DPkg::Lock::Timeout=120 native flag
  * captures stderr to show real error if install fails
- lib/website.sh: install_nginx/install_certbot use apt_install
  (fixes "Could not get lock /var/lib/dpkg/lock-frontend" during Pro setup)
- install.sh: bot_install uses apt_install (removes duplicated lock logic)
- lib/common.sh: ensure_deps uses apt_update + apt_install
This commit is contained in:
anten-ka
2026-04-10 20:01:20 +03:00
parent 3403975636
commit eb5175ccab
4 changed files with 77 additions and 49 deletions

View File

@@ -9,9 +9,9 @@ install_nginx() {
fi
log_info "Установка nginx..."
case "$(get_pkg_manager)" in
apt) apt-get update -qq && apt-get install -y -qq nginx ;;
dnf) dnf install -y -q nginx ;;
yum) yum install -y -q nginx ;;
apt) apt_update && apt_install nginx || return 1 ;;
dnf) dnf install -y -q nginx || return 1 ;;
yum) yum install -y -q nginx || return 1 ;;
esac
systemctl enable nginx 2>/dev/null
}
@@ -24,9 +24,9 @@ install_certbot() {
fi
log_info "Установка certbot..."
case "$(get_pkg_manager)" in
apt) apt-get install -y -qq certbot python3-certbot-nginx ;;
dnf) dnf install -y -q certbot python3-certbot-nginx ;;
yum) yum install -y -q certbot python3-certbot-nginx ;;
apt) apt_install certbot python3-certbot-nginx || return 1 ;;
dnf) dnf install -y -q certbot python3-certbot-nginx || return 1 ;;
yum) yum install -y -q certbot python3-certbot-nginx || return 1 ;;
esac
}