feat: serve the one-line installer from the site

The site serves install.sh at /retrobios/i and install.ps1 at
/retrobios/i.ps1. generate_site.py writes both copies with the
installer address set to install.py at the commit the site is built
from (GITHUB_SHA in CI, HEAD locally), so the pinned SHA-256 and the
downloaded installer always come from one commit, including while a
deploy is still running.

Every command a user copies names the short address. The raw form
stays on the installer page as the fallback. Deploy Site now runs on
changes to install.sh and install.ps1. The install box weight keeps
the address length its ratio was fitted on, so no console page moves.
This commit is contained in:
Abdessamad Derraz committed 2026-10-28 05:47:38 +01:00
1 parent 7c3e6ced09
commit 9e6af0aa6b
37 files changed
+486 -110

No files matched your search

+23 -2
View File
@@ -99,6 +99,8 @@ from siteguides import (
HandheldSystem,
FENCE_TITLES,
INSTALL_BASE,
INSTALL_PS1,
INSTALL_SH,
TERMINALS,
TRUST_ITEMS,
detected_systems as _detected_systems,
@@ -111,6 +113,7 @@ from siteguides import (
trust_box,
)
import release_record
import sitebootstrap
import sitemeasurements
# The Starlight project, and where its pages go inside it.
@@ -6101,6 +6104,23 @@ SYSTEM_PAGE_BUDGET = 300_000
CARD_HTML_RATIO = 1.7
INSTALL_HTML_RATIO = 11
SYSTEM_SUMMARY_HTML = 500_000
# The ratio was fitted while each command named the raw.githubusercontent.com
# bootstrap, 66 characters (67 for PowerShell). A box is weighed with its
# address at that length, so the shorter site address moves no console off
# or onto a summary and no card changes address.
FITTED_ADDRESS_CHARS = {INSTALL_PS1: 67, INSTALL_SH: 66}
def _install_box_weight(lines: list[str]) -> int:
weight = 0
for line in lines:
weight += len(line) + 1
for address, fitted in FITTED_ADDRESS_CHARS.items():
found = line.count(address)
line = line.replace(address, "")
weight += found * (fitted - len(address))
return weight
# A system card: whether it is a variant, its lines, its sha1.
Card = tuple[bool, list[str], str]
@@ -7252,8 +7272,7 @@ def system_pages(
# page, which the card weights never counted. A page is also cut when
# its estimate as it renders passes the summary's.
with markup.using("mkdocs"):
boxes = {console: sum(len(line) + 1 for line in install_block(console))
for console in consoles}
boxes = {console: _install_box_weight(install_block(console)) for console in consoles}
rendered = {console: CARD_HTML_RATIO * weights[console] + INSTALL_HTML_RATIO * boxes[console]
for console in weights}
if (not boards and len(measured_text) <= budget
@@ -11763,6 +11782,8 @@ def _generate(args: argparse.Namespace) -> None:
# this project site lives under /retrobios/. Every page's head points at
# the sitemap instead (Starlight's head links it).
(public / "robots.txt").unlink(missing_ok=True)
# The one-line commands' bootstraps, at the site's root.
sitebootstrap.write_bootstraps(public, _REPO_ROOT)
images_dest = public / "assets" / "images"
images_dest.mkdir(parents=True, exist_ok=True)