mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-07-12 18:19:42 -07:00
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:
+21
-8
@@ -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.
|
||||
|
||||
@@ -177,8 +177,10 @@ mkdir -p $BASEDIR/$LOGDIR
|
||||
done
|
||||
|
||||
# pack logfiles
|
||||
mkdir -p /storage/logfiles
|
||||
zip -jq /storage/logfiles/log-$DATE.zip $BASEDIR/$LOGDIR/*
|
||||
# /var/log is /storage/.cache/log via var-log.mount on ArchR; lands on
|
||||
# the rw overlay through the FHS path.
|
||||
mkdir -p /var/log/archr/archive
|
||||
zip -jq /var/log/archr/archive/log-$DATE.zip $BASEDIR/$LOGDIR/*
|
||||
|
||||
# remove logdir
|
||||
rm -rf ${BASEDIR:?}/$LOGDIR
|
||||
|
||||
@@ -58,6 +58,10 @@ EOF
|
||||
# both `touch /var/cache/archr/fstrim.run` (writes through) and
|
||||
# readers checking the stamp.
|
||||
ln -sf /storage/.cache/fstrim.run ${INSTALL}/var/cache/archr/fstrim.run
|
||||
# Image-based updates: backing path /storage/.update is what the
|
||||
# pre-boot bootloader scripts know about and cannot move; userland
|
||||
# tooling reads/writes through the FHS bridge.
|
||||
ln -sf /storage/.update ${INSTALL}/var/cache/archr/update
|
||||
}
|
||||
|
||||
post_install() {
|
||||
|
||||
@@ -85,17 +85,17 @@ main_update() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure that the /storage/.update folder exists.
|
||||
if [ ! -d "/storage/.update" ]; then
|
||||
mkdir -p /storage/.update || { echo "Failed to create /storage/.update directory."; exit 1; }
|
||||
# Ensure that the /var/cache/archr/update folder exists.
|
||||
if [ ! -d "/var/cache/archr/update" ]; then
|
||||
mkdir -p /var/cache/archr/update || { echo "Failed to create /var/cache/archr/update directory."; exit 1; }
|
||||
fi
|
||||
|
||||
# Extract the file name from the update URL.
|
||||
filename=$(basename "$update_url")
|
||||
|
||||
# Define download destinations inside /storage/.update folder using the original file names.
|
||||
update_file="/storage/.update/${filename}"
|
||||
checksum_file="/storage/.update/${filename}.sha256"
|
||||
# Define download destinations inside /var/cache/archr/update folder using the original file names.
|
||||
update_file="/var/cache/archr/update/${filename}"
|
||||
checksum_file="/var/cache/archr/update/${filename}.sha256"
|
||||
|
||||
# Download the update file.
|
||||
echo "Downloading update file..."
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
. /etc/os-release
|
||||
|
||||
### Vars
|
||||
UPDATE_ROOT="/storage/.update"
|
||||
UPDATE_ROOT="/var/cache/archr/update"
|
||||
MOUNT_GAMES=$(get_setting system.automount)
|
||||
GAMES_DEVICE=$(get_setting system.gamesdevice)
|
||||
MS_PATH="/storage/roms"
|
||||
|
||||
@@ -78,6 +78,9 @@ case "${1}" in
|
||||
umount /storage/roms 2>/dev/null ||:
|
||||
umount /storage/games-external 2>/dev/null ||:
|
||||
cd /
|
||||
# /storage/.update is the backing path that the pre-boot bootloader
|
||||
# scripts know about; preserve it by the real path (the FHS bridge
|
||||
# /var/cache/archr/update points at the same dir).
|
||||
find /storage -mindepth 1 \( ! -regex '^/storage/.update.*' -a ! -regex '^/storage/roms.*' -a ! -regex '^/storage/games-.*' \) -delete 2>/dev/null
|
||||
mkdir /storage/.config/
|
||||
sync 2>/dev/null
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
|
||||
### Shell trace + persistent debug log are gated by system.loglevel=verbose.
|
||||
### Default (off/none/quiet) writes nothing to microSD on launch.
|
||||
### /var/log is mounted from /storage/.cache/log by var-log.mount, so
|
||||
### /var/log/runemu-debug.log lands on the rw overlay and survives.
|
||||
if [ "$(get_setting system.loglevel)" = "verbose" ]; then
|
||||
RUNEMU_DEBUG="/storage/.cache/log/runemu-debug.log"
|
||||
RUNEMU_DEBUG="/var/log/runemu-debug.log"
|
||||
mkdir -p "$(dirname "${RUNEMU_DEBUG}")"
|
||||
exec 2>>"${RUNEMU_DEBUG}"
|
||||
set -x
|
||||
|
||||
@@ -50,11 +50,13 @@
|
||||
# writeable shares of disks and paths under /storage
|
||||
|
||||
[update]
|
||||
path = /storage/.update
|
||||
path = /var/cache/archr/update
|
||||
available = yes
|
||||
browseable = yes
|
||||
public = yes
|
||||
writeable = yes
|
||||
follow symlinks = yes
|
||||
wide links = yes
|
||||
|
||||
[games-roms]
|
||||
path = /storage/roms
|
||||
|
||||
@@ -6,4 +6,8 @@ d /run/archr/debug 0755 root root - -
|
||||
d /run/dbus 0755 root root - -
|
||||
d /storage/.cache/rfkill 0755 root root - -
|
||||
d /storage/.cache/mesa_shader_cache 0755 root root - -
|
||||
# /var/log is /storage/.cache/log via var-log.mount; this creates the
|
||||
# archive subdir for createlog's log-DATE.zip dumps in an FHS-friendly
|
||||
# place. The trailing /var/log/archr path is what users and samba see.
|
||||
d /storage/.cache/log/archr/archive 0755 root root - -
|
||||
L+ /var/lib/systemd/rfkill - - - - /storage/.cache/rfkill
|
||||
|
||||
Reference in New Issue
Block a user