Treat Fedora Atomic's /home and /var/home spellings as the same managed release root during install, staging, and rollback. Add a regression test for the Bazzite home-directory alias.
- commit
- b7809e9e3fd3cadf62f4ce7b80ce66968ae0d98f
- parent
- 0bc5b443ddd38f84f95865de54b5337ca8a6906e
- author
- Dami <dami.etoile@gmail.com>
| M | scripts/ | 6 | ++++- |
| M | scripts/ | 5 | +++- |
| M | scripts/ | 5 | +++- |
| A | scripts/ | 40 | ++++++++++++++++++++++++++++++ |
@@ -186,7 +186,11 @@ if [[ -e "$current_link" || -L "$current_link" ]]; then
186186 [[ -L "$current_link" ]] || die "current activation is not a symlink"187187 current_path="$(readlink -f "$current_link")"188188 [[ -n "$current_path" && -d "$current_path" ]] || die "current activation is dangling"189- [[ "$(dirname -- "$current_path")" == "$releases_root" ]] || die "current activation escapes the release root"189+ # Fedora Atomic/Bazzite exposes /home through /var/home. Compare canonical190+ # paths on both sides so a managed activation remains valid regardless of191+ # which equivalent spelling systemd or the login session used for $HOME.192+ [[ "$(dirname -- "$current_path")" == "$(readlink -f "$releases_root")" ]] \193+ || die "current activation escapes the release root"190194 current_release_id="$(basename -- "$current_path")"191195 fi192196 if [[ -e "$previous_link" || -L "$previous_link" ]]; then@@ -68,7 +68,10 @@ resolve_activation() {
6868 [[ -L "$link" ]] || die "$label activation is missing or is not a symlink"6969 resolved="$(readlink -f "$link")"7070 [[ -n "$resolved" && -d "$resolved" ]] || die "$label activation is dangling"71- [[ "$(dirname -- "$resolved")" == "$releases_root" ]] || die "$label activation escapes the release root"71+ # Fedora Atomic/Bazzite exposes /home through /var/home. Compare canonical72+ # paths on both sides so the managed symlink does not appear to escape.73+ [[ "$(dirname -- "$resolved")" == "$(readlink -f "$releases_root")" ]] \74+ || die "$label activation escapes the release root"7275 basename -- "$resolved"7376 }7477 @@ -155,7 +155,10 @@ if [[ -e "$current_link" || -L "$current_link" ]]; then
155155 [[ -L "$current_link" ]] || die "current activation is not a symlink"156156 current_path="$(readlink -f "$current_link")"157157 [[ -n "$current_path" && -d "$current_path" ]] || die "current activation is dangling"158- [[ "$(dirname -- "$current_path")" == "$releases_root" ]] || die "current activation escapes the release root"158+ # Fedora Atomic/Bazzite exposes /home through /var/home. Compare canonical159+ # paths on both sides so the managed symlink does not appear to escape.160+ [[ "$(dirname -- "$current_path")" == "$(readlink -f "$releases_root")" ]] \161+ || die "current activation escapes the release root"159162 current_release_id="$(basename -- "$current_path")"160163 [[ "$current_release_id" =~ ^[0-9a-f]{7,64}$ ]] || die "current activation has an invalid release ID"161164 fi@@ -0,0 +1,40 @@
1+2+3+set -euo pipefail4+5+tmp_root="$(mktemp -d "${TMPDIR:-/tmp}/sigil-home-path.XXXXXX")"6+cleanup() {7+ local status=$?8+ trap - EXIT INT TERM HUP9+ case "$tmp_root" in10+ */sigil-home-path.??????) rm -rf -- "$tmp_root" ;;11+ esac12+ exit "$status"13+}14+trap cleanup EXIT INT TERM HUP15+16+release_id=0123456789abcdef17+canonical_releases="$tmp_root/var/home/tank/.local/libexec/sigil-spark/releases"18+install -d -m 0700 "$canonical_releases/$release_id"19+ln -s var/home "$tmp_root/home"20+install_root="$tmp_root/home/tank/.local/libexec/sigil-spark"21+ln -s "releases/$release_id" "$install_root/current"22+23+resolved_current="$(readlink -f "$install_root/current")"24+spelled_releases="$install_root/releases"25+[[ "$(dirname -- "$resolved_current")" != "$spelled_releases" ]]26+[[ "$(dirname -- "$resolved_current")" == "$(readlink -f "$spelled_releases")" ]]27+28+repo_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd -P)"29+for script in \30+ install-bazzite-package.sh \31+ rollback-bazzite-release.sh \32+ stage-bazzite-release.sh33+do34+ # Intentional literal: the production scripts must canonicalize this exact35+ # runtime variable rather than the test shell expanding it here.36+ # shellcheck disable=SC201637+ grep -Fq '$(readlink -f "$releases_root")' "$repo_dir/scripts/$script"38+done39+40+printf 'bazzite_canonical_home_tests=ok\n'