#!/bin/sh set -e case "$1" in upgrade|configure) if [ -d /run/systemd/system ]; then # Always ensure the bluetooth systemd override file is present echo "Installing bluetooth systemd override file..." if [ ! -d /etc/systemd/system/bluetooth.service.d ]; then echo "Creating bluetooth systemd override directory..." mkdir -p /etc/systemd/system/bluetooth.service.d fi cp /usr/share/nvidia/nvidia-disable-bt-profiles/systemd/system/bluetooth.service.d/bluetooth-override.conf /etc/systemd/system/bluetooth.service.d/nv-disable-bt-override.conf || true # Restart bluetooth systemctl --system daemon-reload >/dev/null || true systemctl --system restart bluetooth >/dev/null || true # 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