aur/fcp-support-git.install
Sebastian Paul e44a239e2b Fix auto-stop issue and add polkit rule (pkgrel=2)
- Add systemd drop-in override to fix StopWhenUnneeded auto-stop issue
- Add polkit rule for passwordless fcp-server management by audio group
- Improve post_install messages with troubleshooting guidance
- Add polkit to optdepends

This fixes the reliability issue where fcp-server would stop immediately
after being started by udev, preventing alsa-scarlett-gui from connecting.

Changes follow best practices:
- Drop-in override (non-invasive, survives upstream updates)
- Polkit rule follows PulseAudio/PipeWire precedent for audio group
- Comprehensive security review completed (see SECURITY_REVIEW.md)
2025-10-22 16:41:27 +02:00

82 lines
2.8 KiB
Text

post_install() {
echo ""
echo "==> Setting required capabilities on fcp-server..."
if ! setcap cap_sys_rawio+ep /usr/bin/fcp-server; then
echo "WARNING: Failed to set capabilities on fcp-server"
echo " You may need to run manually: sudo setcap cap_sys_rawio+ep /usr/bin/fcp-server"
fi
echo "==> Reloading systemd and udev..."
systemctl daemon-reload
udevadm control --reload-rules
echo "==> Triggering udev for Focusrite devices..."
udevadm trigger --action=add --subsystem-match=sound --attr-match=idVendor=1235
echo ""
echo "==> Focusrite Control Protocol Server installed successfully!"
echo ""
echo " The fcp-server service should now be running if your"
echo " Focusrite Scarlett 4th Gen device (16i16/18i16/18i20) is connected."
echo ""
echo "==> Check service status:"
echo " systemctl status fcp-server@*"
echo ""
echo "==> Make sure you are in the 'audio' group:"
echo " sudo usermod -a -G audio \$USER"
echo " (then log out and back in)"
echo ""
echo "==> Package improvements in this version:"
echo " - Fixed auto-stop issue (service now stays running reliably)"
echo " - Added polkit rule (audio group can manage fcp-server without password)"
echo " - Better integration with alsa-scarlett-gui"
echo ""
echo "==> Install 'alsa-scarlett-gui-git' for a graphical interface:"
echo " yay -S alsa-scarlett-gui-git"
echo ""
echo "==> Firmware update required on first use:"
echo " Install scarlett4-firmware package and run:"
echo " fcp-tool --update-firmware"
echo ""
echo "==> Troubleshooting:"
echo " If service doesn't auto-start, manually start it:"
echo " systemctl start fcp-server@<card-number>"
echo " (find card number with: aplay -l)"
echo " View logs: journalctl -u 'fcp-server@*' -f"
echo ""
}
post_upgrade() {
echo ""
echo "==> Setting required capabilities on fcp-server..."
if ! setcap cap_sys_rawio+ep /usr/bin/fcp-server; then
echo "WARNING: Failed to set capabilities on fcp-server"
echo " You may need to run manually: sudo setcap cap_sys_rawio+ep /usr/bin/fcp-server"
fi
echo "==> Reloading systemd and udev..."
systemctl daemon-reload
udevadm control --reload-rules
echo "==> Restarting fcp-server..."
systemctl restart fcp-server@* 2>/dev/null || true
echo ""
echo "==> fcp-support has been updated"
echo " Service status: systemctl status fcp-server@*"
echo ""
}
pre_remove() {
echo ""
echo "==> Stopping fcp-server services..."
systemctl stop 'fcp-server@*' 2>/dev/null || true
}
post_remove() {
echo ""
echo "==> Reloading systemd and udev..."
systemctl daemon-reload
udevadm control --reload-rules
echo ""
}