Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
411acd6d18
|
||
|
|
2c523afa6f
|
||
|
|
2a589e9b91
|
No files matched your search
@@ -26,9 +26,7 @@ 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.
|
||||
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 the keyboard 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. Esc there goes back to a bilingual language screen, where English 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
-10
@@ -277,9 +277,9 @@ ocr_screen() {
|
||||
screendump "$shot"
|
||||
[[ -s $shot ]] || return 0
|
||||
magick "$shot" -colorspace gray -negate -resize 150% "$prepped" 2>/dev/null || return 0
|
||||
# The logo and the black strip under foot throw tesseract off CJK, so Chinese runs also read between them, without spaces.
|
||||
# The logo throws tesseract off CJK, so Chinese runs also read below it, without spaces.
|
||||
if [[ $INSTALL_LANGUAGE == "zh" ]]; then
|
||||
magick "$shot" -gravity north -chop 0x35% -gravity south -chop 0x4% -colorspace gray -negate -resize 150% "$prepped.text.png" 2>/dev/null || return 0
|
||||
magick "$shot" -gravity north -chop 0x35% -colorspace gray -negate -resize 150% "$prepped.text.png" 2>/dev/null || return 0
|
||||
{ tesseract "$prepped" - --psm 6 -l "$OCR_LANGS"; tesseract "$prepped.text.png" - --psm 6 -l "$OCR_LANGS"; } 2>/dev/null | sed 'p; s/ //g' || true
|
||||
else
|
||||
tesseract "$prepped" - --psm 6 -l "$OCR_LANGS" 2>/dev/null || true
|
||||
@@ -696,14 +696,7 @@ drive_configurator() {
|
||||
if [[ $INSTALL_LANGUAGE == "zh" ]]; then press end; else press home; fi
|
||||
press ret
|
||||
|
||||
# Chinese reruns in cage + foot on a bilingual language screen, Chinese preselected.
|
||||
if [[ $INSTALL_LANGUAGE == "zh" ]]; then
|
||||
wait_for_screen "选择语言" 300
|
||||
capture_console "success-installer-01-language-cjk"
|
||||
press ret
|
||||
fi
|
||||
|
||||
# The keyboard follows; Ctrl+C there defers provisioning.
|
||||
# The keyboard follows, for Chinese in cage + foot; Ctrl+C there defers provisioning.
|
||||
wait_for_screen "$(lang_text "keyboard layout" "键盘布局")" 300
|
||||
capture_console "success-installer-01-keyboard-layout"
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -306,9 +306,14 @@ keyboard_form() {
|
||||
say --foreground 8 "$(omarchy_text "Press Ctrl+C to prepare this machine for another owner.")"
|
||||
echo
|
||||
|
||||
omarchy_prompt_language && status=0 || status=$?
|
||||
status=0
|
||||
if ! $language_chosen; then
|
||||
omarchy_prompt_language && status=0 || status=$?
|
||||
((status == 0)) && apply_language
|
||||
fi
|
||||
# Esc, Ctrl+C or a later "No, change it" asks the language again.
|
||||
language_chosen=false
|
||||
if ((status == 0)); then
|
||||
apply_language
|
||||
local layouts=$OMARCHY_KEYBOARD_LAYOUTS selected="English (US)"
|
||||
[[ $language == "zh" ]] && selected="Chinese (Simplified, Pinyin)"
|
||||
# cage keeps its US layout, so the CJK console offers only US-keymap keyboards.
|
||||
@@ -406,7 +411,7 @@ $(omarchy_text "Full name"),${full_name:-$skipped}
|
||||
$(omarchy_text "Email address"),${email_address:-$skipped}
|
||||
$(omarchy_text Hostname),$hostname
|
||||
$(omarchy_text Timezone),$timezone$region_row
|
||||
$(omarchy_text Keyboard),$keyboard" |
|
||||
$(omarchy_text Keyboard),\"$keyboard_label\"" |
|
||||
gum table -s "," -p | sed "s/^/${PADDING_LEFT_SPACES}/"
|
||||
|
||||
echo
|
||||
@@ -1146,6 +1151,7 @@ defer_provisioning=false
|
||||
install_target="full_disk"
|
||||
# A rerun arrives with the language chosen; otherwise English.
|
||||
language="${OMARCHY_INSTALL_LANGUAGE:-en}"
|
||||
language_chosen=false
|
||||
|
||||
# Let the live VT reach its settled width before the first screen so the logo
|
||||
# isn't measured against the transient 80-column boot console.
|
||||
@@ -1153,6 +1159,7 @@ wait_for_stable_terminal
|
||||
|
||||
if [[ -n ${OMARCHY_INSTALL_LANGUAGE:-} ]]; then
|
||||
apply_language
|
||||
language_chosen=true
|
||||
else
|
||||
greeter
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# The Chinese installer's console: the VT's Tokyo Night palette, with Noto Sans Mono CJK from the offline mirror.
|
||||
[main]
|
||||
font=Noto Sans Mono CJK SC:size=13
|
||||
# Noto's tall default rows leave the summary too few lines for the logo.
|
||||
line-height=22px
|
||||
|
||||
[colors-dark]
|
||||
background=1a1b26
|
||||
@@ -21,3 +23,7 @@ bright4=7aa2f7
|
||||
bright5=bb9af7
|
||||
bright6=7dcfff
|
||||
bright7=c0caf5
|
||||
|
||||
# cage draws no title bar, and a reserved one leaves a black strip.
|
||||
[csd]
|
||||
preferred=none
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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()
|
||||
Reference in new issue
Block a user