fix: wait for dpkg lock and fix menu not opening via curl pipe

install_package() now waits up to 60s for unattended-upgrades to
release the dpkg lock instead of failing immediately. Also redirect
stdin from /dev/tty when exec'ing the menu so the terminal check
passes when the installer was invoked via curl | bash.
This commit is contained in:
SamNet-dev
2026-02-13 00:29:32 -06:00
parent b6e729cced
commit 784956796d

View File

@@ -162,6 +162,19 @@ install_package() {
case "$PKG_MANAGER" in case "$PKG_MANAGER" in
apt) apt)
# Wait for dpkg lock if held by another process (e.g. unattended-upgrades)
local _apt_tries=0
while fuser /var/lib/dpkg/lock-frontend &>/dev/null 2>&1; do
if [ $_apt_tries -eq 0 ]; then
log_warn "Waiting for dpkg lock (held by another process)..."
fi
_apt_tries=$((_apt_tries + 1))
if [ $_apt_tries -ge 30 ]; then
log_error "dpkg lock held for too long, skipping $package"
return 1
fi
sleep 2
done
apt-get update -q || log_warn "apt-get update failed, attempting install anyway..." apt-get update -q || log_warn "apt-get update failed, attempting install anyway..."
if apt-get install -y -q "$package"; then if apt-get install -y -q "$package"; then
log_success "$package installed successfully" log_success "$package installed successfully"
@@ -15153,7 +15166,7 @@ SVCEOF
systemctl restart conduit-telegram 2>/dev/null || true systemctl restart conduit-telegram 2>/dev/null || true
fi fi
fi fi
exec "$INSTALL_DIR/conduit" menu exec "$INSTALL_DIR/conduit" menu < /dev/tty
;; ;;
2) 2)
echo "" echo ""