summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortranch <tranch.xiao@gmail.com>2026-10-23 10:23:18 +0800
committertranch <tranch.xiao@gmail.com>2026-10-23 10:23:25 +0800
commit20253bfffc4815e1c48aebb8ede28527ce80ad3e (patch)
treea9fda76356d12b75b1a1531ddd15b205ed892495
parent92805891f11bd9aa358247557fb432262bf17877 (diff)
downloadAeroCore-OS-20253bfffc4815e1c48aebb8ede28527ce80ad3e.tar.gz
AeroCore-OS-20253bfffc4815e1c48aebb8ede28527ce80ad3e.zip
fix: detect Game Mode channel from booted imagetesting-44.20261023
Read the booted deployment reference instead of filtering status by the os-release ID, which differs from AeroCore image names.
-rwxr-xr-xbuild_files/build.sh1
-rwxr-xr-xbuild_files/patch-bazzite-os-branch-select.sh35
2 files changed, 36 insertions, 0 deletions
diff --git a/build_files/build.sh b/build_files/build.sh
index 988b7f0..1875ddf 100755
--- a/build_files/build.sh
+++ b/build_files/build.sh
@@ -170,3 +170,4 @@ find /etc/environment.d /etc/skel/.config/environment.d -name 99-aerocore-mirror
/ctx/install-instruments.sh
/ctx/patch-bazzite-deck-identity.sh
/ctx/patch-bazzite-rollback-helper.sh
+/ctx/patch-bazzite-os-branch-select.sh
diff --git a/build_files/patch-bazzite-os-branch-select.sh b/build_files/patch-bazzite-os-branch-select.sh
new file mode 100755
index 0000000..544b1a5
--- /dev/null
+++ b/build_files/patch-bazzite-os-branch-select.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/bash
+
+set -euo pipefail
+
+file=/usr/libexec/os-branch-select
+
+if [[ ! -f "$file" ]]; then
+ echo "Unable to locate Bazzite OS branch selector: $file" >&2
+ exit 1
+fi
+
+old=' branch=$(cut -d ":" -f4 <<< "$(rpm-ostree status --booted | grep -m 1 $ID)")'
+if ! grep -Fxq "$old" "$file"; then
+ echo "Bazzite OS branch selector changed; review the downstream patch" >&2
+ exit 1
+fi
+
+patched_file=$(mktemp)
+awk -v old="$old" '
+ $0 == old {
+ print " # Read the booted deployment directly; its image name need not match os-release ID."
+ print " image_ref=$(rpm-ostree status --booted --json | jq -r '\''[.deployments[] | select(.booted) | .[\"container-image-reference\"] // empty][0] // empty'\'')"
+ print " branch=\"\""
+ print " if [[ $image_ref =~ :([^/:]+)$ ]]; then"
+ print " branch=${BASH_REMATCH[1]}"
+ print " fi"
+ found++
+ next
+ }
+ { print }
+ END { if (found != 1) exit 1 }
+' "$file" > "$patched_file"
+
+install -m 0755 "$patched_file" "$file"
+rm -f "$patched_file"