37 lines
955 B
Plaintext
37 lines
955 B
Plaintext
_apply_command="/usr/bin/dell-xps13-sidecar-amps-apply"
|
|
|
|
_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" -eq 0 ] || return "$status"
|
|
case "$output" in
|
|
*"ERROR:"*) return 1 ;;
|
|
esac
|
|
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
|
|
}
|
|
|
|
post_install() {
|
|
"$_apply_command" || return
|
|
printf ':: Reboot to enable the Dell XPS 13 sidecar speaker amplifiers.\n'
|
|
}
|
|
|
|
post_upgrade() {
|
|
"$_apply_command" || return
|
|
printf ':: Reboot to apply the Dell XPS 13 sidecar amplifier update.\n'
|
|
}
|
|
|
|
post_remove() {
|
|
_rebuild_boot_images || return
|
|
printf ':: Reboot to finish removing the Dell XPS 13 sidecar amplifier workaround.\n'
|
|
}
|