FHS F0: introduce ARCHR_* path vocabulary

profile.d/010-archr-fhs exports seven variables (ARCHR_ETC,
ARCHR_CONFIG, ARCHR_CACHE, ARCHR_DATA, ARCHR_GAMES, ARCHR_LOG,
ARCHR_TMP) that future ArchR scripts should read instead of
hardcoding /storage/.config and siblings. Every variable defaults to
its current /storage location so behaviour is identical to today;
subsequent FHS phases will flip the right-hand side without touching
the callers.

archr(7) gains an ENVIRONMENT section describing each variable, its
current value and its FHS target so anyone writing a new script knows
which name to use.

docs/fhs-mapping.md: F0 marked complete; F1..F7 still pending.

Risk: zero. The new file is read at login but only sets variables.
No script reads them yet.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Douglas Teles
2026-06-23 15:35:31 -03:00
parent cc5febb42f
commit ca904d5257
3 changed files with 101 additions and 1 deletions
+1 -1
View File
@@ -172,6 +172,6 @@ Migration scripts ficam em `projects/ArchR/packages/archr/sources/post-update.d/
- [x] Auditoria de 297 paths concluída (2026-06-23).
- [x] Mapeamento por classe definido.
- [ ] Fase 0 (vocabulário) — em andamento.
- [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.
- [ ] Fase 1 — não iniciada.
- [ ] Fase 2..7 — não iniciadas.
@@ -0,0 +1,46 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2026-present ArchR (https://github.com/archr-linux)
#
# ArchR Filesystem Hierarchy vocabulary
# -------------------------------------
# Phase 0 of the FHS migration (Arch-ification 2.2).
#
# These variables establish the Arch-friendly vocabulary for paths that
# ArchR scripts use. During this phase they point to the legacy
# LibreELEC-style /storage layout, so nothing changes at runtime.
# Subsequent phases migrate each path class to its FHS destination by
# flipping the right-hand side of the assignments here, while the
# variable name stays stable for callers.
#
# See docs/fhs-mapping.md in the source tree for the full plan.
#
# Convention for downstream scripts: always read paths via these
# variables, never hardcode "/storage/.config" again. Example:
#
# config_dir="${ARCHR_CONFIG}/drastic"
# instead of
# config_dir="/storage/.config/drastic"
#
# When a script is migrated to use ${ARCHR_X}, the next phase can move
# the underlying data without touching that script.
# Class A: system configuration (-> /etc/archr eventually)
export ARCHR_ETC="${ARCHR_ETC:-/storage/.config}"
# Class B: user/app configuration (-> /var/lib/archr/config eventually)
export ARCHR_CONFIG="${ARCHR_CONFIG:-/storage/.config}"
# Class C: regenerable cache (-> /var/cache/archr eventually)
export ARCHR_CACHE="${ARCHR_CACHE:-/storage/.cache}"
# Class D: persistent state/data (-> /var/lib/archr/data eventually)
export ARCHR_DATA="${ARCHR_DATA:-/storage/.local/share}"
# Class E: user games library and adjacent media (-> /var/lib/archr/games eventually)
export ARCHR_GAMES="${ARCHR_GAMES:-/storage/roms}"
# Class F: log files (-> /var/log/archr eventually)
export ARCHR_LOG="${ARCHR_LOG:-/storage/.cache/log}"
# Class G: ephemeral temp (-> /var/tmp/archr eventually)
export ARCHR_TMP="${ARCHR_TMP:-/storage/.tmp}"
@@ -62,6 +62,60 @@ Send anonymized telemetry when the user opts in.
.TP
.B archr-retroachievements-info
Display RetroAchievements account state and recent unlocks.
.SH ENVIRONMENT
ArchR scripts read filesystem paths through the
.B ARCHR_*
family of variables, exported by
.IR /etc/profile.d/010-archr-fhs .
This vocabulary is stable; the underlying paths migrate to FHS locations
across releases (see
.IR docs/fhs-mapping.md
in the source tree). Callers should never hardcode
.IR /storage/.config
or its siblings; use the variable instead.
.TP
.B ARCHR_ETC
System configuration. Currently
.IR /storage/.config ;
target
.IR /etc/archr .
.TP
.B ARCHR_CONFIG
User and application configuration (emulators, EmulationStation,
PortMaster). Currently
.IR /storage/.config ;
target
.IR /var/lib/archr/config .
.TP
.B ARCHR_CACHE
Regenerable cache (shader cache, fontconfig, service state). Currently
.IR /storage/.cache ;
target
.IR /var/cache/archr .
.TP
.B ARCHR_DATA
Persistent state and data. Currently
.IR /storage/.local/share ;
target
.IR /var/lib/archr/data .
.TP
.B ARCHR_GAMES
Games library root (ROMs, saves, screenshots, recordings). Currently
.IR /storage/roms ;
target
.IR /var/lib/archr/games .
.TP
.B ARCHR_LOG
Log files. Currently
.IR /storage/.cache/log ;
target
.IR /var/log/archr .
.TP
.B ARCHR_TMP
Ephemeral temp. Currently
.IR /storage/.tmp ;
target
.IR /var/tmp/archr .
.SH FILES
.TP
.I /etc/os-release