fix: use build-essential, enable universe repository, and add apt-get lock timeout for dependency installation.

This commit is contained in:
Omid Zamani
2026-01-06 12:58:51 +01:00
parent a8536c2af2
commit a995894dbd
2 changed files with 14 additions and 4 deletions

View File

@@ -130,8 +130,8 @@ def _install_remote_venv_with_chatmaild() -> None:
)
apt.packages(
name="install gcc and headers to build crypt_r source package",
packages=["gcc", "python3-dev"],
name="install build-essential and headers to build crypt_r source package",
packages=["build-essential", "python3-dev"],
)
server.shell(
@@ -504,6 +504,10 @@ class ChatmailDeployer(Deployer):
name="Fix broken packages",
commands=["apt-get install -f -y"],
)
server.shell(
name="Enable universe repository",
commands=["add-apt-repository -y universe || true"],
)
apt.update(name="apt update", cache_time=24 * 3600)
apt.upgrade(name="upgrade apt packages", auto_remove=True)

10
init.sh
View File

@@ -3,8 +3,14 @@ set -e
# 1. Update and install dependencies
echo "--- Installing dependencies ---"
sudo apt update
sudo apt install -y git curl wget python3-dev gcc python3 nano sed
# Ubuntu 24.04 and others might need universe for python3-dev
if command -v add-apt-repository > /dev/null 2>&1; then
sudo add-apt-repository -y universe
fi
# We use a timeout for the lock to handle automatic updates running in the background
sudo apt-get update -o DPkg::Lock::Timeout=120
sudo apt-get install -y -o DPkg::Lock::Timeout=120 git curl wget python3-dev build-essential python3 nano sed
# 1.1 Install uv
export PATH="$HOME/.local/bin:/root/.local/bin:$PATH"