#!/bin/sh set -e case "$1" in remove|purge) if [ -d /run/systemd/system ]; then # Remove bluetooth systemd override file if it exists to ensure the default behavior is restored if [ -f /etc/systemd/system/bluetooth.service.d/nv-disable-bt-override.conf ]; then echo "Removing bluetooth systemd override file..." rm -f /etc/systemd/system/bluetooth.service.d/nv-disable-bt-override.conf # Remove the directory if it's empty if rmdir /etc/systemd/system/bluetooth.service.d 2>/dev/null; then echo "Removed empty bluetooth systemd override directory" fi # Restart bluetooth systemctl --system daemon-reload >/dev/null || true systemctl --system restart bluetooth >/dev/null || true fi # Restart wireplumber for all users running it ps -eo user,comm | grep wireplumber | awk '{print $1}' | sort -u | while read user; do sudo -u "${user}" sh -c 'export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus"; systemctl --user restart wireplumber.service' >/dev/null 2>&1 || true done fi ;; esac exit 0