summaryrefslogtreecommitdiff
path: root/build_files/patch-bazzite-deck-identity.sh
diff options
context:
space:
mode:
authorTranch <tranch.xiao@gmail.com>2026-07-22 17:26:46 +0800
committerGitHub <noreply@github.com>2026-07-22 17:26:46 +0800
commit677aaf3fbbe3f941c1b782980dbc0b422d937027 (patch)
tree8156006e752aa03a910281021ffb5f364927a8d6 /build_files/patch-bazzite-deck-identity.sh
parent96aac6e87ac41b27383d1839687f391925080007 (diff)
parent5198f735cf5a8c9e8390c2fa2156252c79be72ab (diff)
downloadAeroCore-OS-677aaf3fbbe3f941c1b782980dbc0b422d937027.tar.gz
AeroCore-OS-677aaf3fbbe3f941c1b782980dbc0b422d937027.zip
Merge pull request #2 from AeroCore-IO/testing
Complete AeroCore OS metadata migration and live installer integration
Diffstat (limited to 'build_files/patch-bazzite-deck-identity.sh')
-rwxr-xr-xbuild_files/patch-bazzite-deck-identity.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/build_files/patch-bazzite-deck-identity.sh b/build_files/patch-bazzite-deck-identity.sh
new file mode 100755
index 0000000..078b76c
--- /dev/null
+++ b/build_files/patch-bazzite-deck-identity.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/bash
+
+set -euo pipefail
+
+hardware_setup="${1:-/usr/libexec/bazzite-hardware-setup}"
+# These are literal source lines; variable expansion must happen at boot time.
+# shellcheck disable=SC2016
+old_condition='if [[ "$IMAGE_NAME" != *deck* && "$IMAGE_NAME" != *dx* ]]; then'
+# shellcheck disable=SC2016
+new_condition='if [[ "$IMAGE_NAME" != aerocore-os && "$IMAGE_NAME" != *deck* && "$IMAGE_NAME" != *dx* ]]; then'
+
+if grep -Fqx "$new_condition" "$hardware_setup"; then
+ exit 0
+fi
+
+if [[ "$(grep -Fxc "$old_condition" "$hardware_setup")" -ne 1 ]]; then
+ echo "Unable to locate the Bazzite Deck image check in $hardware_setup" >&2
+ exit 1
+fi
+
+patched_file=$(mktemp)
+trap 'rm -f "$patched_file"' EXIT
+
+awk \
+ -v old_condition="$old_condition" \
+ -v new_condition="$new_condition" \
+ '$0 == old_condition {
+ print new_condition
+ next
+ }
+ { print }' "$hardware_setup" > "$patched_file"
+
+cp "$patched_file" "$hardware_setup"
+
+grep -Fqx "$new_condition" "$hardware_setup"