Drop the local-build pin; local test installs take published updates
This commit is contained in:
5 files changed
-155
No files matched your search
@@ -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.
|
||||
|
||||
|
||||
Reference in new issue
Block a user