FHS F3: logs and update over Arch paths

Class F (logs) and Class G (temp/update) reshuffled.

Logs:
- /var/log was already a mount from /storage/.cache/log via
  packages/sysutils/busybox/system.d/var-log.mount, so journald already
  writes to /var/log/journal in FHS terms. runemu.sh debug log moves
  from /storage/.cache/log/runemu-debug.log to /var/log/runemu-debug.log
  (same physical bytes, FHS surface).
- createlog (top-level busybox script) packs archive zips into
  /var/log/archr/archive instead of /storage/logfiles. ArchR tmpfiles
  z_01_archr.conf creates the backing dir under the storage overlay so
  the path is writable on first boot.

Update:
- /var/cache/archr/update is a bridge symlink to /storage/.update added
  by the archr meta-package. archr-update, automount and the [update]
  samba share all flipped to the FHS path.
- factoryreset still preserves /storage/.update by its real name in
  the find regex; that path is also what the pre-boot bootloader
  scripts read, so the backing path is the canonical one and the
  bridge is just the userland surface. Comment added so this is
  obvious to future readers.
- busybox/scripts/init keeps UPDATE_ROOT=/storage/.update because it
  runs in the initramfs before /var is even available.

Overlayfs workdirs (/storage/.tmp/*-workdir) and /storage/.boot.hint
documented as no-op in fhs-mapping.md: the overlayfs kernel layer
requires upperdir and workdir to share a filesystem, and the boot
hint is part of the U-Boot handshake.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Douglas Teles
2026-06-23 16:02:59 -03:00
parent baddc23110
commit 71d8968a1a
9 changed files with 49 additions and 19 deletions
+21 -8
View File
@@ -101,15 +101,28 @@ Hosts/resolv têm pipeline próprio (script `network-base-setup` lê
- `timezone`**Fase 7** (referenciado em patch do systemd; mover requer ajuste no patch)
- `debug.archr`**Fase 7** (stamp file trivial)
### Fase 3 — Class F + G: logs e temp (13 paths)
### Fase 3 — Class F + G: logs e temp
**Objetivo:** alinhar com convenção `/var/log` e `/var/tmp`.
**Status: concluída (2026-06-23).** Logs viram `/var/log/*` (que já é mount unit redirecionando para `/storage/.cache/log`); update vira `/var/cache/archr/update` via bridge symlink; overlayfs workdirs e bootloader handshake ficam no backing path por constraint de arquitetura.
- `/storage/.cache/log/journal``/var/log/journal` (já é convenção systemd)
- `/storage/.cache/log/runemu-debug.log``/var/log/archr/runemu-debug.log`
- `/storage/logfiles/` `/var/log/archr/`
- `/storage/.tmp/*-workdir` `/var/tmp/archr/*-workdir`
- `/storage/.update/` `/var/cache/archr/update/`
| Path | Destino | Mecanismo |
|------|---------|-----------|
| `/storage/.cache/log/journal` | `/var/log/journal` | `var-log.mount` já existente (no-op) |
| `/storage/.cache/log/runemu-debug.log` | `/var/log/runemu-debug.log` | runemu.sh aponta direto pro `/var/log` (mount entrega) |
| `/storage/logfiles` | `/var/log/archr/archive` | createlog escreve via mount; tmpfiles cria backing |
| `/storage/.update` | `/var/cache/archr/update` | bridge symlink; consumers userland atualizados |
**Permanecem no backing path por design:**
- `/storage/.tmp/*-workdir` (assets, cores, database, games, joypads, overlays, shaders): são *workdirs* de `overlayfs` montados em `system.d/tmp-*.mount` units. O kernel exige que `upperdir` e `workdir` estejam no mesmo filesystem; como `upperdir=/storage/<x>`, o `workdir` tem que ficar no mesmo `/storage`. Mover para `/var/tmp/archr` quebraria os 6 mount units de assets/cores/database/joypads/overlays/shaders do RetroArch. No-op.
- `/storage/.boot.hint`: arquivo de handshake entre o bootloader U-Boot e o sistema rodando, gravado pré-boot pelo bootloader e lido por `autostart/003-upgrade`. Compartilhar via FHS exigiria mexer no script u-boot, fora de escopo. No-op.
**Pré-boot keep-as-is:**
- `busybox/scripts/init` (initramfs UPDATE_ROOT)
- `devices/RK3326/bootloader/update.sh` (escreve `.boot.hint`)
- `tmpfiles z_01_busybox.conf` (cria backing dirs)
Userland tudo usa o path Arch-friendly.
### Fase 4 — Class D: state/data persistente (37 paths)
@@ -194,5 +207,5 @@ Migration scripts ficam em `projects/ArchR/packages/archr/sources/post-update.d/
- [x] Fase 0 concluída (2026-06-23): `010-archr-fhs` em `/etc/profile.d`, archr(7) com seção ENVIRONMENT, vars apontando para `/storage/...`. Risco zero.
- [x] Fase 1 marcada como no-op (2026-06-23): systemd já entrega `/etc/{modules-load.d,sysctl.d,tmpfiles.d,udev/{hwdb,rules}.d,systemd/*conf.d}` via symlinks de build-time. FHS-correto sem mudança. Detalhes na seção da Fase 1 deste documento.
- [x] Fase 2 concluída (2026-06-23): 5 caches realmente regeneráveis migrados via bridge symlinks (mesa, fontconfig, kernel-overlays, locpath, fstrim.run). Paths state/log realocados para F3/F4. Detalhes na Fase 2.
- [ ] Fase 3 — não iniciada (Class F+G: logs e temp).
- [x] Fase 3 concluída (2026-06-23): logs reaproveitam `var-log.mount` (/var/log = /storage/.cache/log), update bridged via `/var/cache/archr/update`, overlayfs workdirs e bootloader handshake permanecem no backing path por constraint.
- [ ] Fase 4..7 — não iniciadas.