Both buster and bullseye now switch unconditionally to archive.debian.org (no probing). bullseye-security lines are commented out because archive.debian.org does not carry bullseye-security yet (404), avoiding apt update errors. _probe_url and all probe/revert logic removed (~60 lines). Docs updated accordingly.
4.6 KiB
AGENTS.md
Shell scripts that backport OpenSSH from Debian sid to older Debian/Ubuntu distros.
Build order (must be sequential)
./pullsrc.sh— download OpenSSH sources from Debian sid pool intodownloads/, plus the sid debhelper .debs intobuilddep/(needed byinstall_deps.shon old distros;./pullsrc.sh debhelperfetches only the .debs)./install_deps.sh— fix EOL/mirror sources then install build dependencies via apt; on distros with debhelper < 13.12 it installsbuilddep/*.deband applies old-distro compat sed hacks./compile.sh— build .deb packages intooutput/
Version source of truth
version.env defines OPENSSLVER, pins DEBHELPER_SIDPKG (sid debhelper .debs; empty = auto-detect latest from the pool), and auto-detects OPENSSH_SIDPKG by scraping http://deb.debian.org/debian/pool/main/o/openssh/. It is sourced (not executed) by compile.sh and pullsrc.sh. Do not run it directly.
Key env vars
FORCESSL=1— force static OpenSSL linking even on distros with libssl >= 3.0APT_MIRROR— substitute apt sources mirror (e.g.mirrors.ustc.edu.cn); also applied when switching EOL Debian sources to archive handling (archive.debian.org)DEB_BUILD_OPTIONSandDEB_BUILD_PROFILESare set insidecompile.shto skip tests and udebs
Package versioning
The distro codename is appended to the package version (~${BUILD_CODENAME}) during compile. The version is pinned via OPENSSH_SIDPKG in version.env; if that variable is empty, it falls back to auto-detecting the latest from Debian sid.
Docker build
./pullsrc.sh debhelper # host: populate builddep/ (required for old-distro dep images)
docker build --build-arg BASE_IMAGE=ubuntu:noble -f docker/Dockerfile.deps -t <tag> .
docker/Dockerfile.deps uses BuildKit --mount=type=bind for install_deps.sh and builddep/, so neither lands in an image layer (BuildKit is required; it is the default in modern docker).
EOL distro sources: For EOL Debian releases (e.g. buster) the default
deb.debian.orgno longer serves the repository.install_deps.shnow automatically switches EOL Debian sources toarchive.debian.org(adding the-backportspocket) before apt operations;switch_archive_sources.shhas been removed; EOL handling (buster and bullseye both switch unconditionally; bullseye-security is commented out as archive.debian.org does not carry it yet) is now fully insideinstall_deps.sh.docker/Dockerfile.depsand CI both invokeinstall_deps.shdirectly.
pullsrc on the host
Old distros often ship old ca-certificates (or none in minimal images),
which can no longer verify GitHub's TLS chain. The release CI avoids this
by running ./pullsrc.sh on the host runner (current CA store), then
mounting the repository into the build container with -v. pullsrc.sh
also downloads the sid debhelper .debs into builddep/ (gitignored), which
install_deps.sh installs on distros whose own debhelper is < 13.12 — so
pullsrc.sh must run before install_deps.sh. When building manually for
an old distro, apply the same pattern:
./pullsrc.sh
docker run --rm -v "$(pwd):/work" -w /work debian:buster bash -c "./install_deps.sh && ./compile.sh"
Directories
| Directory | Purpose |
|---|---|
downloads/ |
Downloaded source tarballs (gitignored) |
build/ |
Temporary build tree (gitignored) |
output/ |
Final .deb packages |
builddep/ |
Sid debhelper .debs downloaded by pullsrc.sh (gitignored) |
Release workflow
When a new upstream version is built and released:
- Scrape the latest sid version to get the new value for
OPENSSH_SIDPKG:wget -qO- http://deb.debian.org/debian/pool/main/o/openssh/ | grep -oP 'openssh_\K[0-9]+\.[0-9]+p[0-9]+-[0-9]+(?:~bpo[0-9]+(?:\+[0-9]+)?)?' | sort -V | tail -n 1 - Update
OPENSSH_SIDPKGinversion.envand the- OpenSSH ...line inREADME.mdwith the new version. - Commit the change:
git add README.md version.env && git commit -m "bump version to <new-version>" - Tag the release:
git tag v<new-version>_b1(prefixv, suffix_b1= build 1; increment for rebuilds) - Push:
git push && git push --tags
Known distro-specific quirks
- Kylin V10 SP1: must run
./compile.shfrom a desktop terminal (not SSH),kysec_authdialog requires manual approval - UnionTech OS Desktop 20: exclude
libfido2-dev, installdwzanddh-runitfrom bullseye fail2ban/sshguardneed config changes for OpenSSH >= 9.8 (sshd → sshd-session)