Drop the local-build pin; local test installs take published updates

This commit is contained in:
ZacharyZhang-NY committed 2026-10-11 23:49:08 -04:00
1 parent 30f63b674e
commit 2a589e9b91
5 files changed
-155

No files matched your search

-2
View File
@@ -26,8 +26,6 @@ For local development, build the ISO from sibling checkouts:
Despite the local folder name, the first argument is the Omarchy source checkout (runtime commands, configs, setup scripts, themes, shell, migrations). The installer itself lives in this ISO repo.
A local-source install pins `omarchy-dev` and `omarchy-settings-dev`, since the published builds share their version number but lack the local changes. `IgnorePkg` in `/etc/pacman.conf` makes updates skip them, and a `pre-refresh-pacman` hook (in the user's `~/.config/omarchy/hooks` and in `/etc/skel`) puts that line back after `omarchy refresh pacman`. `/etc/pacman.d/hooks/00-omarchy-pin-local-builds.hook` aborts any transaction that would still replace them. Remove all three to take the published packages.
The configurator asks for the language on its first screen: English or Simplified Chinese. Chinese reruns the installer in cage + foot, a console that draws Chinese, with Noto Sans Mono CJK unpacked from the offline mirror's `noto-fonts-cjk`. It opens on a bilingual language screen, offers only keyboards with a US keymap (cage keeps a US layout) and preselects Chinese (Simplified, Pinyin); every later screen and the install progress read in Chinese. Choosing English there returns to the VT, which applies the chosen keymap. Without a working display or the font, Chinese continues in English on the VT. Either way a Chinese install sets the target's `LANG` to `zh_CN.UTF-8` through archinstall's `locale_config`. The language never decides the region: that follows the timezone. The Chinese text lives in `OMARCHY_ZH` tables beside the English it replaces.
Use `--dev` or `--rc` to build against those package channels. Both `--dev` and `--edge` select the dev packages from the edge mirror.
-3
View File
@@ -105,9 +105,6 @@ fi
if [[ -d /omarchy-source && -d /omarchy-pkgs ]]; then
bash /builder/build-omarchy-packages.sh "$offline_mirror_dir"
LOCAL_OMARCHY_BUILD=1
# Published builds of these lack the local changes, so the target pins them.
printf '%s\n' "$OMARCHY_RUNTIME_PACKAGE" "$OMARCHY_SETTINGS_PACKAGE" \
> "$build_cache_dir/airootfs/usr/share/omarchy-iso/pinned-packages"
fi
# Node.js binary for offline mise install.
@@ -37,7 +37,6 @@ def build_phases(ctx: InstallContext):
stage_provisioning_state,
finalize_limine_boot,
run_chroot_finalizer,
pin_local_packages,
configure_dns_resolver,
configure_login,
configure_ssh_access,
@@ -57,7 +56,6 @@ def build_phases(ctx: InstallContext):
("Staging provisioning", stage_provisioning_state),
("Finalizing Limine boot", finalize_limine_boot),
("Finalizing user", run_chroot_finalizer),
("Pinning local builds", pin_local_packages),
("Configuring login", configure_login),
("Configuring SSH access", configure_ssh_access),
("Configuring Tailscale", configure_tailscale),
@@ -1400,67 +1400,6 @@ def run_chroot_finalizer(ctx: InstallContext) -> None:
)
PINNED_PACKAGES = Path("/usr/share/omarchy-iso/pinned-packages")
PIN_HOOK_SCRIPT = """#!/bin/bash
# omarchy refresh pacman rewrites pacman.conf; keep this ISO's local builds pinned.
line="{line}"
grep -qxF "$line" /etc/pacman.conf || sudo sed -i "/^\\[options\\]/a $line" /etc/pacman.conf
"""
PIN_GUARD = """[Trigger]
Operation = Upgrade
Type = Package
{targets}
[Action]
Description = Keeping the local Omarchy builds...
When = PreTransaction
Exec = /usr/bin/sh -c 'echo "This would replace the local builds of {names}. Put \\"{line}\\" back under [options] in /etc/pacman.conf, or delete /etc/pacman.d/hooks/00-omarchy-pin-local-builds.hook to take the published packages." >&2; exit 1'
AbortOnFail
"""
# Local-source builds share the published version number, so updates would replace them.
def pin_local_packages(ctx: InstallContext) -> None:
if not PINNED_PACKAGES.exists():
return
packages = PINNED_PACKAGES.read_text().split()
line = "IgnorePkg = " + " ".join(packages)
info(f"› {line}")
pacman_conf = ctx.target / "etc" / "pacman.conf"
conf = pacman_conf.read_text()
if line not in conf.splitlines():
if "[options]\n" not in conf:
raise RuntimeError(f"{pacman_conf} has no [options] section to pin local builds in")
pacman_conf.write_text(conf.replace("[options]\n", f"[options]\n{line}\n", 1))
guard = ctx.target / "etc/pacman.d/hooks/00-omarchy-pin-local-builds.hook"
guard.parent.mkdir(parents=True, exist_ok=True)
guard.write_text(PIN_GUARD.format(
targets="\n".join(f"Target = {package}" for package in packages),
names=", ".join(packages),
line=line,
))
hook_path = ".config/omarchy/hooks/pre-refresh-pacman.d/pin-local-packages"
homes = [ctx.target / "etc/skel"]
if not ctx.defer_provisioning:
homes.append(ctx.target / "home" / ctx.username)
for home in homes:
hook = home / hook_path
hook.parent.mkdir(parents=True, exist_ok=True)
hook.write_text(PIN_HOOK_SCRIPT.format(line=line))
hook.chmod(0o755)
if not ctx.defer_provisioning:
subprocess.run(
["arch-chroot", str(ctx.target), "chown", "-R", f"{ctx.username}:{ctx.username}",
f"/home/{ctx.username}/.config/omarchy/hooks"],
check=True,
)
def configure_dns_resolver(ctx: InstallContext) -> None:
"""Put the installed system in systemd-resolved stub mode.
-87
View File
@@ -1,87 +0,0 @@
"""Local-source installs pin the packages the ISO built from the checkouts."""
import subprocess
import sys
import tempfile
import types
import unittest
from pathlib import Path
from unittest import mock
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT / "configs/airootfs/usr/share/omarchy-iso"))
sys.modules.setdefault(
"orchestrator.archinstall_adapter",
types.ModuleType("orchestrator.archinstall_adapter"),
)
from orchestrator import phases_impl # noqa: E402
LINE = "IgnorePkg = omarchy-dev omarchy-settings-dev"
CONF = "[options]\nHoldPkg = pacman glibc\n\n[core]\nInclude = /etc/pacman.d/mirrorlist\n"
class PinLocalPackagesTest(unittest.TestCase):
def run_pin(self, root: Path, *, pinned: bool, defer: bool = False):
(root / "etc").mkdir()
(root / "etc/pacman.conf").write_text(CONF)
pinned_file = root / "pinned-packages"
if pinned:
pinned_file.write_text("omarchy-dev\nomarchy-settings-dev\n")
ctx = types.SimpleNamespace(target=root, username="test", defer_provisioning=defer)
with mock.patch.object(phases_impl, "PINNED_PACKAGES", pinned_file), \
mock.patch.object(phases_impl.subprocess, "run") as run:
phases_impl.pin_local_packages(ctx)
phases_impl.pin_local_packages(ctx)
return run
def test_pins_once_and_installs_refresh_hook(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
run = self.run_pin(root, pinned=True)
self.assertEqual((root / "etc/pacman.conf").read_text(), CONF.replace("[options]\n", f"[options]\n{LINE}\n"))
hook = root / "home/test/.config/omarchy/hooks/pre-refresh-pacman.d/pin-local-packages"
self.assertIn(f'line="{LINE}"', hook.read_text())
self.assertTrue(hook.stat().st_mode & 0o111)
guard = (root / "etc/pacman.d/hooks/00-omarchy-pin-local-builds.hook").read_text()
for package in ("omarchy-dev", "omarchy-settings-dev"):
self.assertIn(f"Target = {package}\n", guard)
self.assertIn("AbortOnFail", guard)
skel = root / "etc/skel/.config/omarchy/hooks/pre-refresh-pacman.d/pin-local-packages"
self.assertEqual(skel.read_text(), hook.read_text())
run.assert_called_with(
["arch-chroot", str(root), "chown", "-R", "test:test", "/home/test/.config/omarchy/hooks"],
check=True,
)
def test_hook_restores_the_pin_after_a_refresh(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
self.run_pin(root, pinned=True)
hook = root / "home/test/.config/omarchy/hooks/pre-refresh-pacman.d/pin-local-packages"
conf = root / "pacman.conf"
conf.write_text(CONF)
script = hook.read_text().replace("/etc/pacman.conf", str(conf)).replace("sudo ", "")
for _ in range(2):
subprocess.run(["bash", "-c", script], check=True)
self.assertEqual(conf.read_text(), CONF.replace("[options]\n", f"[options]\n{LINE}\n"))
def test_deferred_install_stages_the_hook_for_the_first_owner(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
run = self.run_pin(root, pinned=True, defer=True)
self.assertIn(LINE, (root / "etc/pacman.conf").read_text())
self.assertTrue((root / "etc/pacman.d/hooks/00-omarchy-pin-local-builds.hook").exists())
self.assertTrue((root / "etc/skel/.config/omarchy/hooks/pre-refresh-pacman.d/pin-local-packages").exists())
self.assertFalse((root / "home").exists())
run.assert_not_called()
def test_published_builds_stay_unpinned(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
self.run_pin(root, pinned=False)
self.assertEqual((root / "etc/pacman.conf").read_text(), CONF)
self.assertFalse((root / "etc/pacman.d").exists())
if __name__ == "__main__":
unittest.main()