From e4608f18bc3a5ad307e1a1deaa7ac0048d03f991 Mon Sep 17 00:00:00 2001 From: tranch Date: Thu, 27 Aug 2026 08:08:00 +0800 Subject: fix: replace symlinked desktop branding assets --- .github/workflows/validate-installer-iso.yml | 4 ++ build_files/build.sh | 43 +++++++++++++++++- .../system/aerocore-desktop-branding.service | 11 +++++ system_files/usr/libexec/aerocore-desktop-branding | 28 ++++++++++++ .../aerocore/desktop-branding/kcm-about-distrorc | 5 +++ .../plasmoidsetupscripts/org.kde.plasma.kickoff.js | 5 +++ .../plasmoidsetupscripts/org.kde.plasma.kickoff.js | 5 +++ tests/test-desktop-branding-migration.sh | 51 ++++++++++++++++++++++ 8 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 system_files/usr/lib/systemd/system/aerocore-desktop-branding.service create mode 100755 system_files/usr/libexec/aerocore-desktop-branding create mode 100644 system_files/usr/share/aerocore/desktop-branding/kcm-about-distrorc create mode 100644 system_files/usr/share/plasma/look-and-feel/com.valve.vapor.desktop/contents/plasmoidsetupscripts/org.kde.plasma.kickoff.js create mode 100644 system_files/usr/share/plasma/look-and-feel/com.valve.vgui.desktop/contents/plasmoidsetupscripts/org.kde.plasma.kickoff.js create mode 100755 tests/test-desktop-branding-migration.sh diff --git a/.github/workflows/validate-installer-iso.yml b/.github/workflows/validate-installer-iso.yml index d98964d..25d6c44 100644 --- a/.github/workflows/validate-installer-iso.yml +++ b/.github/workflows/validate-installer-iso.yml @@ -53,10 +53,14 @@ jobs: bash -n "$script" done bash -n system_files/usr/libexec/aerocore-instruments-setup + bash -n system_files/usr/libexec/aerocore-desktop-branding - name: Test Bazzite Deck identity patch run: tests/test-patch-bazzite-deck-identity.sh + - name: Test desktop branding migration + run: tests/test-desktop-branding-migration.sh + - name: Test GPT root configuration run: tests/test-configure-target-gpt-root.sh diff --git a/build_files/build.sh b/build_files/build.sh index 5a7f780..b4acb10 100755 --- a/build_files/build.sh +++ b/build_files/build.sh @@ -14,6 +14,17 @@ esac # Copy the contents of system_files/ of the git repo to / cp -avf "/ctx/system_files"/. / +install_regular_file() { + local source_file="$1" + local destination_file="$2" + + # Several Bazzite branding paths are symlinks. cp follows an existing + # destination symlink, which leaves the name Plasma resolves untouched. + # Replace the link itself so the final immutable image owns this exact path. + rm -f -- "${destination_file}" + install -Dm0644 -- "${source_file}" "${destination_file}" +} + # KDE's Deck presets use distributor-logo-steamdeck.svg for the Kickoff # launcher. In the Bazzite base image that name (and the related aliases) # may already exist as links to the upstream distributor-logo.svg. Install @@ -27,9 +38,37 @@ for icon_name in \ distributor-logo-steamdeck.svg \ bazzite-logo.svg \ start-here.svg; do - cp -f "${AEROCORE_DISTRIBUTOR_LOGO}" "${AEROCORE_ICON_DIR}/${icon_name}" + install_regular_file "${AEROCORE_DISTRIBUTOR_LOGO}" "${AEROCORE_ICON_DIR}/${icon_name}" +done + +# Use a downstream-specific, non-upstream icon name for Plasma's launcher. +install_regular_file \ + "/ctx/system_files/usr/share/pixmaps/bazzite-logo-le.svg" \ + "/usr/share/icons/hicolor/scalable/apps/aerocore-logo.svg" + +# Game Mode's Vapor splash asset is an upstream symlink on current Bazzite +# images, while VGUI is a regular file. Replace both exact paths explicitly. +for look_and_feel in com.valve.vapor.desktop com.valve.vgui.desktop; do + install_regular_file \ + "/ctx/system_files/usr/share/plasma/look-and-feel/${look_and_feel}/contents/splash/images/bazzite_logo.svgz" \ + "/usr/share/plasma/look-and-feel/${look_and_feel}/contents/splash/images/bazzite_logo.svgz" done +# Steam's Game Mode transitions load these four assets directly. They are +# symlinks in some upstream layers, so replace their directory entries just +# like the Plasma splash assets above. +for animation in \ + bazzite.webm \ + bazzite-oled.webm \ + bazzite-suspend.webm \ + bazzite-suspend-oled.webm; do + install_regular_file \ + "/ctx/system_files/usr/share/ublue-os/bazzite/${animation}" \ + "/usr/share/ublue-os/bazzite/${animation}" +done + +gtk-update-icon-cache -f /usr/share/icons/hicolor || true + # The Plasma launcher resolves the standard start-here name from both scalable # and per-size places directories. Populate every existing Bazzite icon size # in the installed payload, not only in the live installer image. @@ -90,5 +129,7 @@ fi find /etc/environment.d /etc/skel/.config/environment.d -name 99-aerocore-mirrors.conf -type f -exec chmod 0644 {} + 2>/dev/null || true +systemctl enable aerocore-desktop-branding.service + /ctx/install-instruments.sh /ctx/patch-bazzite-deck-identity.sh diff --git a/system_files/usr/lib/systemd/system/aerocore-desktop-branding.service b/system_files/usr/lib/systemd/system/aerocore-desktop-branding.service new file mode 100644 index 0000000..fee52f1 --- /dev/null +++ b/system_files/usr/lib/systemd/system/aerocore-desktop-branding.service @@ -0,0 +1,11 @@ +[Unit] +Description=Apply AeroCore desktop branding migrations +After=local-fs.target +Before=display-manager.service + +[Service] +Type=oneshot +ExecStart=/usr/libexec/aerocore-desktop-branding + +[Install] +WantedBy=graphical.target diff --git a/system_files/usr/libexec/aerocore-desktop-branding b/system_files/usr/libexec/aerocore-desktop-branding new file mode 100755 index 0000000..8b8b9e0 --- /dev/null +++ b/system_files/usr/libexec/aerocore-desktop-branding @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# The optional prefix makes the migration testable without touching the host. +root_prefix="${AEROCORE_DESKTOP_BRANDING_ROOT:-}" +about_source="${root_prefix}/usr/share/aerocore/desktop-branding/kcm-about-distrorc" +about_target="${root_prefix}/etc/xdg/kcm-about-distrorc" + +# Existing installations can retain Bazzite's old /etc copy across deployment +# updates. Only replace that known upstream default; administrator changes win. +if [[ -f "${about_source}" ]] && + { [[ ! -f "${about_target}" ]] || grep -Fxq 'Name=Bazzite' "${about_target}"; }; then + install -Dm0644 "${about_source}" "${about_target}" +fi + +# Deck's stock look-and-feel stores this value in each user's Plasma config. +# Migrate only the unmodified upstream value so users can still choose an icon. +shopt -s nullglob +for plasma_config in "${root_prefix}"/var/home/*/.config/plasma-org.kde.plasma.desktop-appletsrc \ + "${root_prefix}"/home/*/.config/plasma-org.kde.plasma.desktop-appletsrc; do + if grep -Fxq 'icon=distributor-logo-steamdeck' "${plasma_config}"; then + updated_config="$(mktemp "${plasma_config}.XXXXXX")" + sed 's/^icon=distributor-logo-steamdeck$/icon=aerocore-logo/' "${plasma_config}" > "${updated_config}" + cat "${updated_config}" > "${plasma_config}" + rm -f "${updated_config}" + fi +done diff --git a/system_files/usr/share/aerocore/desktop-branding/kcm-about-distrorc b/system_files/usr/share/aerocore/desktop-branding/kcm-about-distrorc new file mode 100644 index 0000000..ed2c831 --- /dev/null +++ b/system_files/usr/share/aerocore/desktop-branding/kcm-about-distrorc @@ -0,0 +1,5 @@ +[General] +LogoPath=/usr/share/pixmaps/system-logo-white.png +Name=AeroCore OS +Website=https://os.aerocore.com.cn +Variant=Handheld & HTPC Edition diff --git a/system_files/usr/share/plasma/look-and-feel/com.valve.vapor.desktop/contents/plasmoidsetupscripts/org.kde.plasma.kickoff.js b/system_files/usr/share/plasma/look-and-feel/com.valve.vapor.desktop/contents/plasmoidsetupscripts/org.kde.plasma.kickoff.js new file mode 100644 index 0000000..76ec66d --- /dev/null +++ b/system_files/usr/share/plasma/look-and-feel/com.valve.vapor.desktop/contents/plasmoidsetupscripts/org.kde.plasma.kickoff.js @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +applet.currentConfigGroup = ["General"] +applet.writeConfig("icon", "aerocore-logo") +applet.reloadConfig() diff --git a/system_files/usr/share/plasma/look-and-feel/com.valve.vgui.desktop/contents/plasmoidsetupscripts/org.kde.plasma.kickoff.js b/system_files/usr/share/plasma/look-and-feel/com.valve.vgui.desktop/contents/plasmoidsetupscripts/org.kde.plasma.kickoff.js new file mode 100644 index 0000000..76ec66d --- /dev/null +++ b/system_files/usr/share/plasma/look-and-feel/com.valve.vgui.desktop/contents/plasmoidsetupscripts/org.kde.plasma.kickoff.js @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +applet.currentConfigGroup = ["General"] +applet.writeConfig("icon", "aerocore-logo") +applet.reloadConfig() diff --git a/tests/test-desktop-branding-migration.sh b/tests/test-desktop-branding-migration.sh new file mode 100755 index 0000000..23ebdd2 --- /dev/null +++ b/tests/test-desktop-branding-migration.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +test_root="$(mktemp -d -t aerocore-desktop-branding.XXXXXXXXXX)" +trap 'rm -rf "${test_root}"' EXIT + +mkdir -p \ + "${test_root}/usr/share/aerocore/desktop-branding" \ + "${test_root}/etc/xdg" \ + "${test_root}/var/home/stock/.config" \ + "${test_root}/var/home/custom/.config" + +cp "${repo_root}/system_files/usr/share/aerocore/desktop-branding/kcm-about-distrorc" \ + "${test_root}/usr/share/aerocore/desktop-branding/kcm-about-distrorc" +printf '%s\n' '[General]' 'Name=Bazzite' > "${test_root}/etc/xdg/kcm-about-distrorc" +printf '%s\n' 'icon=distributor-logo-steamdeck' \ + > "${test_root}/var/home/stock/.config/plasma-org.kde.plasma.desktop-appletsrc" +printf '%s\n' 'icon=user-selected-logo' \ + > "${test_root}/var/home/custom/.config/plasma-org.kde.plasma.desktop-appletsrc" + +AEROCORE_DESKTOP_BRANDING_ROOT="${test_root}" \ + bash "${repo_root}/system_files/usr/libexec/aerocore-desktop-branding" + +grep -Fxq 'Name=AeroCore OS' "${test_root}/etc/xdg/kcm-about-distrorc" +grep -Fxq 'icon=aerocore-logo' \ + "${test_root}/var/home/stock/.config/plasma-org.kde.plasma.desktop-appletsrc" +grep -Fxq 'icon=user-selected-logo' \ + "${test_root}/var/home/custom/.config/plasma-org.kde.plasma.desktop-appletsrc" + +# The migration must also be idempotent. +first_digest="$(sha256sum \ + "${test_root}/etc/xdg/kcm-about-distrorc" \ + "${test_root}/var/home/stock/.config/plasma-org.kde.plasma.desktop-appletsrc")" +AEROCORE_DESKTOP_BRANDING_ROOT="${test_root}" \ + bash "${repo_root}/system_files/usr/libexec/aerocore-desktop-branding" +second_digest="$(sha256sum \ + "${test_root}/etc/xdg/kcm-about-distrorc" \ + "${test_root}/var/home/stock/.config/plasma-org.kde.plasma.desktop-appletsrc")" +test "${first_digest}" = "${second_digest}" + +for path in \ + bazzite.webm \ + bazzite-oled.webm \ + bazzite-suspend.webm \ + bazzite-suspend-oled.webm; do + grep -Fq "${path}" "${repo_root}/build_files/build.sh" +done + +echo "Desktop branding migration fixture passed" -- cgit v1.2.3