fix(packaging/Linux): ensure that uhid is loaded automatically (#2906)
Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
This commit is contained in:
parent
6de97fdc18
commit
fd96aa0b36
10 changed files with 40 additions and 22 deletions
|
|
@ -47,6 +47,8 @@ function install() {
|
|||
# user input rules
|
||||
# shellcheck disable=SC2002
|
||||
cat "$SUNSHINE_SHARE_HERE/udev/rules.d/60-sunshine.rules" | sudo tee /etc/udev/rules.d/60-sunshine.rules
|
||||
cat "$SUNSHINE_SHARE_HERE/modules-load.d/60-sunshine.conf" | sudo tee /etc/modules-load.d/60-sunshine.conf
|
||||
sudo modprobe uhid
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger --property-match=DEVNAME=/dev/uinput
|
||||
sudo udevadm trigger --property-match=DEVNAME=/dev/uhid
|
||||
|
|
@ -65,6 +67,9 @@ function remove() {
|
|||
# remove input rules
|
||||
sudo rm -f /etc/udev/rules.d/60-sunshine.rules
|
||||
|
||||
# remove uhid module loading config
|
||||
sudo rm -f /etc/modules-load.d/60-sunshine.conf
|
||||
|
||||
# remove service
|
||||
sudo rm -f ~/.config/systemd/user/sunshine.service
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,11 @@ do_udev_reload() {
|
|||
post_install() {
|
||||
do_setcap
|
||||
do_udev_reload
|
||||
modprobe uhid
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
do_setcap
|
||||
do_udev_reload
|
||||
modprobe uhid
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,15 +211,13 @@ xvfb-run ./tests/test_sunshine
|
|||
cd %{_builddir}/Sunshine/build
|
||||
%make_install
|
||||
|
||||
# Add modules-load configuration
|
||||
# load the uhid module in initramfs even if it doesn't detect the module as being used during dracut
|
||||
# which must be run every time a new kernel is installed
|
||||
install -D -m 0644 /dev/stdin %{buildroot}/usr/lib/modules-load.d/uhid.conf <<EOF
|
||||
uhid
|
||||
EOF
|
||||
|
||||
%post
|
||||
# Note: this is copied from the postinst script
|
||||
|
||||
# Load uhid (DS5 emulation)
|
||||
echo "Loading uhid kernel module for DS5 emulation."
|
||||
modprobe uhid
|
||||
|
||||
# Check if we're in an rpm-ostree environment
|
||||
if [ ! -x "$(command -v rpm-ostree)" ]; then
|
||||
echo "Not in an rpm-ostree environment, proceeding with post install steps."
|
||||
|
|
@ -239,10 +237,6 @@ else
|
|||
echo "rpm-ostree environment detected, skipping post install steps. Restart to apply the changes."
|
||||
fi
|
||||
|
||||
%preun
|
||||
# Remove modules-load configuration
|
||||
rm -f /usr/lib/modules-load.d/uhid.conf
|
||||
|
||||
%files
|
||||
# Executables
|
||||
%caps(cap_sys_admin+p) %{_bindir}/sunshine
|
||||
|
|
@ -255,7 +249,7 @@ rm -f /usr/lib/modules-load.d/uhid.conf
|
|||
%{_udevrulesdir}/*-sunshine.rules
|
||||
|
||||
# Modules-load configuration
|
||||
%{_modulesloaddir}/uhid.conf
|
||||
%{_modulesloaddir}/*-sunshine.conf
|
||||
|
||||
# Desktop entries
|
||||
%{_datadir}/applications/*.desktop
|
||||
|
|
|
|||
|
|
@ -6,6 +6,12 @@ cp "/app/share/sunshine/systemd/user/sunshine.service" "$HOME/.config/systemd/us
|
|||
echo "Sunshine User Service has been installed."
|
||||
echo "Use [systemctl --user enable sunshine] once to autostart Sunshine on login."
|
||||
|
||||
# Load uhid (DS5 emulation)
|
||||
UHID=$(cat /app/share/sunshine/modules-load.d/60-sunshine.conf)
|
||||
echo "Enabling DS5 emulation."
|
||||
flatpak-spawn --host pkexec sh -c "echo '$UHID' > /etc/modules-load.d/60-sunshine.conf"
|
||||
flatpak-spawn --host pkexec modprobe uhid
|
||||
|
||||
# Udev rule
|
||||
UDEV=$(cat /app/share/sunshine/udev/rules.d/60-sunshine.rules)
|
||||
echo "Configuring mouse permission."
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ rm "$HOME/.config/systemd/user/sunshine.service"
|
|||
systemctl --user daemon-reload
|
||||
echo "Sunshine User Service has been removed."
|
||||
|
||||
# Udev rule
|
||||
# Remove rules
|
||||
flatpak-spawn --host pkexec sh -c "rm /etc/modules-load.d/60-sunshine.conf"
|
||||
flatpak-spawn --host pkexec sh -c "rm /etc/udev/rules.d/60-sunshine.rules"
|
||||
echo "Input rules removed. Restart computer to take effect."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue