Some checks failed
Mark stable commit / test-unit (push) Has been cancelled
Mark stable commit / test-integration (push) Has been cancelled
Mark stable commit / test-env-virtual (push) Has been cancelled
Mark stable commit / test-env-nix (push) Has been cancelled
Mark stable commit / test-e2e (push) Has been cancelled
Mark stable commit / test-virgin-user (push) Has been cancelled
Mark stable commit / test-virgin-root (push) Has been cancelled
Mark stable commit / mark-stable (push) Has been cancelled
* Switch virgin root/user workflows to use *make install* + *make setup/setup-venv* * Add Git *safe.directory /src* to avoid flake evaluation failures on mounted repos * Enable Nix flake run in workflows and prepare */nix* for non-root execution * Refactor Arch packaging to build in an isolated */tmp* directory via *aur_builder* * Rename installer scripts (*run-** → *dependencies.sh* / *package.sh*) and adjust Docker entry + env var to *REINSTALL_PKGMGR* https://chatgpt.com/share/693c29d9-9b28-800f-a549-5661c783d968
87 lines
3.0 KiB
Bash
Executable File
87 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Detect and export a valid CA bundle so Nix, Git, curl and Python tooling
|
|
# can successfully perform HTTPS requests on all distros (Debian, Ubuntu,
|
|
# Fedora, RHEL, CentOS, etc.)
|
|
# ---------------------------------------------------------------------------
|
|
detect_ca_bundle() {
|
|
# Common CA bundle locations across major Linux distributions
|
|
local candidates=(
|
|
/etc/ssl/certs/ca-certificates.crt # Debian/Ubuntu
|
|
/etc/ssl/cert.pem # Some distros
|
|
/etc/pki/tls/certs/ca-bundle.crt # Fedora/RHEL/CentOS
|
|
/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem # CentOS/RHEL extracted bundle
|
|
/etc/ssl/ca-bundle.pem # Generic fallback
|
|
)
|
|
|
|
for path in "${candidates[@]}"; do
|
|
if [[ -f "$path" ]]; then
|
|
echo "$path"
|
|
return 0
|
|
fi
|
|
done
|
|
|
|
return 1
|
|
}
|
|
|
|
# Use existing NIX_SSL_CERT_FILE if provided, otherwise auto-detect
|
|
CA_BUNDLE="${NIX_SSL_CERT_FILE:-}"
|
|
|
|
if [[ -z "${CA_BUNDLE}" ]]; then
|
|
CA_BUNDLE="$(detect_ca_bundle || true)"
|
|
fi
|
|
|
|
if [[ -n "${CA_BUNDLE}" ]]; then
|
|
# Export for Nix (critical)
|
|
export NIX_SSL_CERT_FILE="${CA_BUNDLE}"
|
|
|
|
# Export for Git, Python requests, curl, etc.
|
|
export SSL_CERT_FILE="${CA_BUNDLE}"
|
|
export REQUESTS_CA_BUNDLE="${CA_BUNDLE}"
|
|
export GIT_SSL_CAINFO="${CA_BUNDLE}"
|
|
|
|
echo "[docker] Using CA bundle: ${CA_BUNDLE}"
|
|
else
|
|
echo "[docker] WARNING: No CA certificate bundle found."
|
|
echo "[docker] HTTPS access for Nix flakes and other tools may fail."
|
|
fi
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
echo "[docker] Starting package-manager container"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Log distribution info
|
|
# ---------------------------------------------------------------------------
|
|
if [[ -f /etc/os-release ]]; then
|
|
# shellcheck disable=SC1091
|
|
. /etc/os-release
|
|
echo "[docker] Detected distro: ${ID:-unknown} (like: ${ID_LIKE:-})"
|
|
fi
|
|
|
|
# Always use /src (mounted from host) as working directory
|
|
echo "[docker] Using /src as working directory"
|
|
cd /src
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# DEV mode: rebuild package-manager from the mounted /src tree
|
|
# ---------------------------------------------------------------------------
|
|
if [[ "${REINSTALL_PKGMGR:-0}" == "1" ]]; then
|
|
echo "[docker] DEV mode enabled (REINSTALL_PKGMGR=1)"
|
|
echo "[docker] Rebuilding package-manager from /src via scripts/installation/package.sh..."
|
|
bash scripts/installation/package.sh || exit 1
|
|
fi
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Hand off to pkgmgr or arbitrary command
|
|
# ---------------------------------------------------------------------------
|
|
if [[ $# -eq 0 ]]; then
|
|
echo "[docker] No arguments provided. Showing pkgmgr help..."
|
|
exec pkgmgr --help
|
|
else
|
|
echo "[docker] Executing command: $*"
|
|
exec "$@"
|
|
fi
|