From 8ab98748c1b718e00e98b937aae1fc24a1abe3e2 Mon Sep 17 00:00:00 2001 From: Spencer Bull Date: Sat, 15 Aug 2026 17:29:37 -0500 Subject: [PATCH] Expose sidecar amplifier apply status --- pkgbuilds/dell-xps13-sidecar-amps/PKGBUILD | 12 ++-- pkgbuilds/dell-xps13-sidecar-amps/README.md | 5 ++ .../dell-xps13-sidecar-amps-apply | 57 +++++++++++++++++++ .../dell-xps13-sidecar-amps.install | 30 +--------- 4 files changed, 73 insertions(+), 31 deletions(-) create mode 100755 pkgbuilds/dell-xps13-sidecar-amps/dell-xps13-sidecar-amps-apply diff --git a/pkgbuilds/dell-xps13-sidecar-amps/PKGBUILD b/pkgbuilds/dell-xps13-sidecar-amps/PKGBUILD index f977221..6e40680 100644 --- a/pkgbuilds/dell-xps13-sidecar-amps/PKGBUILD +++ b/pkgbuilds/dell-xps13-sidecar-amps/PKGBUILD @@ -2,7 +2,7 @@ pkgname=dell-xps13-sidecar-amps pkgver=1.0.0 -pkgrel=1 +pkgrel=2 pkgdesc="Temporary sidecar speaker amplifier enablement for the Dell XPS 13 DX13260" arch=('x86_64') url="https://github.com/omacom-io/omarchy-pkgs" @@ -12,17 +12,21 @@ optdepends=('limine-mkinitcpio-hook: rebuild Limine Unified Kernel Images') install=dell-xps13-sidecar-amps.install options=('!debug') source=( + 'dell-xps13-sidecar-amps-apply' 'dell-xps13-sidecar-amps.conf' 'dell-xps13-sidecar-amps.install' 'LICENSE' 'README.md' ) -sha256sums=('dcef05d30c15b70943e621325d813980894c4c9d646aafe645e73e194f47f9d7' - '69d054e8e156c3449b53a972cde429216bad17841c6937228106ba2102b29e14' +sha256sums=('ec5484486468c483b5a5acc50cd5a0dc5f368425c84bb88cddc95debe71d357e' + 'dcef05d30c15b70943e621325d813980894c4c9d646aafe645e73e194f47f9d7' + '5573370afad9ce25e9b11501154d231e062f2d90f4a99b775bef69b6c736d35c' 'fd9348252dda847b9b4c19e44c5ab101098c7d0470c2238857ce1e14bb63207b' - '95553269a76775ab28d5f376ed0f5daed06fe094e2b4357928f6bebab7731e97') + '82685711fcbe32bec70faa0aaf65032e0c0be4b6c8796123c171e1d7865e7771') package() { + install -Dm755 dell-xps13-sidecar-amps-apply \ + "${pkgdir}/usr/bin/dell-xps13-sidecar-amps-apply" install -Dm644 dell-xps13-sidecar-amps.conf \ "${pkgdir}/usr/lib/modprobe.d/dell-xps13-sidecar-amps.conf" install -Dm644 LICENSE \ diff --git a/pkgbuilds/dell-xps13-sidecar-amps/README.md b/pkgbuilds/dell-xps13-sidecar-amps/README.md index 304b13e..e9f3a7f 100644 --- a/pkgbuilds/dell-xps13-sidecar-amps/README.md +++ b/pkgbuilds/dell-xps13-sidecar-amps/README.md @@ -14,6 +14,11 @@ The package does not replace the kernel, audio firmware, or speaker tuning. It owns only a modprobe drop-in and rebuilds the boot images when installed, upgraded, or removed. +`dell-xps13-sidecar-amps-apply` repeats the legacy cleanup and boot-image +rebuild idempotently. System integrations can run it as root after installation +when they need a directly observable success or failure status; package-manager +scriptlet failures are otherwise only reported by Pacman. + ## Removal Once every kernel you intend to boot contains the upstream commit, remove the diff --git a/pkgbuilds/dell-xps13-sidecar-amps/dell-xps13-sidecar-amps-apply b/pkgbuilds/dell-xps13-sidecar-amps/dell-xps13-sidecar-amps-apply new file mode 100755 index 0000000..b8063a2 --- /dev/null +++ b/pkgbuilds/dell-xps13-sidecar-amps/dell-xps13-sidecar-amps-apply @@ -0,0 +1,57 @@ +#!/bin/bash + +_legacy_override="/etc/modprobe.d/dell-xps13-dx13260-sidecar-amps.conf" +_legacy_sha256="97f36bce41581ecc6b1d7963cd0dab29c7b1a107b2dd4d17db7a56094a7b7289" + +_remove_legacy_override() { + local actual_sha256 hash_output + + [[ -f $_legacy_override ]] || return 0 + if ! hash_output=$(sha256sum "$_legacy_override"); then + printf ':: Unable to hash legacy override: %s\n' "$_legacy_override" >&2 + return 1 + fi + actual_sha256=${hash_output%% *} + + if [[ $actual_sha256 == "$_legacy_sha256" ]]; then + if ! rm -f -- "$_legacy_override"; then + printf ':: Unable to remove legacy override: %s\n' "$_legacy_override" >&2 + return 1 + fi + printf ':: Removed the superseded Dell XPS 13 sidecar amplifier override.\n' + else + printf ':: Preserving modified legacy override: %s\n' "$_legacy_override" + fi +} + +_rebuild_boot_images() { + local output status + + if command -v limine-mkinitcpio >/dev/null 2>&1; then + output=$(limine-mkinitcpio 2>&1) + status=$? + [[ -z $output ]] || printf '%s\n' "$output" + + (( status == 0 )) || return "$status" + [[ $output != *"ERROR:"* ]] || return 1 + elif command -v mkinitcpio >/dev/null 2>&1; then + mkinitcpio -P + else + printf ':: Unable to rebuild boot images: install mkinitcpio and rebuild before rebooting.\n' >&2 + return 1 + fi +} + +apply_sidecar_amp_workaround() { + _remove_legacy_override || return + _rebuild_boot_images || return +} + +if [[ ${BASH_SOURCE[0]} == "$0" ]]; then + if (( EUID != 0 )); then + printf ':: Run dell-xps13-sidecar-amps-apply as root.\n' >&2 + exit 1 + fi + + apply_sidecar_amp_workaround +fi diff --git a/pkgbuilds/dell-xps13-sidecar-amps/dell-xps13-sidecar-amps.install b/pkgbuilds/dell-xps13-sidecar-amps/dell-xps13-sidecar-amps.install index 225c70b..f21e5ed 100644 --- a/pkgbuilds/dell-xps13-sidecar-amps/dell-xps13-sidecar-amps.install +++ b/pkgbuilds/dell-xps13-sidecar-amps/dell-xps13-sidecar-amps.install @@ -1,26 +1,4 @@ -_legacy_override="/etc/modprobe.d/dell-xps13-dx13260-sidecar-amps.conf" -_legacy_sha256="97f36bce41581ecc6b1d7963cd0dab29c7b1a107b2dd4d17db7a56094a7b7289" - -_remove_legacy_override() { - local actual_sha256 hash_output - - [ -f "$_legacy_override" ] || return 0 - if ! hash_output=$(sha256sum "$_legacy_override"); then - printf ':: Unable to hash legacy override: %s\n' "$_legacy_override" >&2 - return 1 - fi - actual_sha256=${hash_output%% *} - - if [ "$actual_sha256" = "$_legacy_sha256" ]; then - if ! rm -f -- "$_legacy_override"; then - printf ':: Unable to remove legacy override: %s\n' "$_legacy_override" >&2 - return 1 - fi - printf ':: Removed the superseded Dell XPS 13 sidecar amplifier override.\n' - else - printf ':: Preserving modified legacy override: %s\n' "$_legacy_override" - fi -} +_apply_command="/usr/bin/dell-xps13-sidecar-amps-apply" _rebuild_boot_images() { local output status @@ -43,14 +21,12 @@ _rebuild_boot_images() { } post_install() { - _remove_legacy_override || return - _rebuild_boot_images || return + "$_apply_command" || return printf ':: Reboot to enable the Dell XPS 13 sidecar speaker amplifiers.\n' } post_upgrade() { - _remove_legacy_override || return - _rebuild_boot_images || return + "$_apply_command" || return printf ':: Reboot to apply the Dell XPS 13 sidecar amplifier update.\n' }