Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cmake/FindSystemd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ IF (NOT WIN32)
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE SYSTEMD_USER_UNIT_INSTALL_DIR)

execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
--variable=systemd_user_preset_dir systemd
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE SYSTEMD_USER_PRESET_INSTALL_DIR)

execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
--variable=systemd_system_unit_dir systemd
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand All @@ -29,7 +34,7 @@ IF (NOT WIN32)
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE SYSTEMD_MODULES_LOAD_DIR)

mark_as_advanced(SYSTEMD_USER_UNIT_INSTALL_DIR SYSTEMD_SYSTEM_UNIT_INSTALL_DIR SYSTEMD_MODULES_LOAD_DIR)
mark_as_advanced(SYSTEMD_USER_UNIT_INSTALL_DIR SYSTEMD_USER_PRESET_INSTALL_DIR SYSTEMD_SYSTEM_UNIT_INSTALL_DIR SYSTEMD_MODULES_LOAD_DIR)

endif ()

Expand Down
4 changes: 4 additions & 0 deletions cmake/packaging/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ if(${SUNSHINE_BUILD_APPIMAGE} OR ${SUNSHINE_BUILD_FLATPAK})
DESTINATION "${SUNSHINE_ASSETS_DIR}/systemd/user")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine-kms.service"
DESTINATION "${SUNSHINE_ASSETS_DIR}/systemd/user")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/00-sunshine-kms.preset"
DESTINATION "${SUNSHINE_ASSETS_DIR}/systemd/user-preset")
else()
find_package(Systemd)
find_package(Udev)
Expand All @@ -33,6 +35,8 @@ else()
DESTINATION "${SYSTEMD_USER_UNIT_INSTALL_DIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine-kms.service"
DESTINATION "${SYSTEMD_USER_UNIT_INSTALL_DIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/00-sunshine-kms.preset"
DESTINATION "${SYSTEMD_USER_PRESET_INSTALL_DIR}")
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/60-sunshine.conf"
DESTINATION "${SYSTEMD_MODULES_LOAD_DIR}")
endif()
Expand Down
1 change: 1 addition & 0 deletions cmake/prep/special_package_configuration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ elseif(UNIX)
# configure service
configure_file(packaging/linux/sunshine.service.in sunshine.service @ONLY)
configure_file(packaging/linux/sunshine-kms.service.in sunshine-kms.service @ONLY)
configure_file(packaging/linux/00-sunshine-kms.preset.in 00-sunshine-kms.preset @ONLY)

# configure the arch linux pkgbuild
if(${SUNSHINE_CONFIGURE_PKGBUILD})
Expand Down
12 changes: 4 additions & 8 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,11 @@ flatpak install --user ./sunshine_{arch}.flatpak
flatpak run --command=additional-install.sh dev.lizardbyte.app.Sunshine
```

##### Run with NVFBC capture (X11 Only)
##### Run with NVFBC capture (X11 Only) or XDG Portal (Wayland Only)
```bash
flatpak run dev.lizardbyte.app.Sunshine
```

##### Run with KMS capture (Wayland & X11)
```bash
sudo -i PULSE_SERVER=unix:/run/user/$(id -u $whoami)/pulse/native flatpak run dev.lizardbyte.app.Sunshine
```

##### Uninstall
```bash
flatpak run --command=remove-additional-install.sh dev.lizardbyte.app.Sunshine
Expand Down Expand Up @@ -430,9 +425,10 @@ After adding yourself to the group, log out and log back in for the changes to t
systemctl --user start sunshine
```

**Start on boot**
**Start on boot (unprivileged; swap logic for KMS)**
```bash
systemctl --user enable sunshine
systemctl --user --now disable sunshine-kms
systemctl --user --now enable sunshine
```

### macOS
Expand Down
10 changes: 5 additions & 5 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ If screencasting fails with KMS, you may be using the unprivileged sunshine serv
sunshine-kms service:

```bash
systemctl --user disable sunshine
systemctl --user enable sunshine-kms --now
systemctl --user --now disable sunshine
systemctl --user --now enable sunshine-kms
```

> [!NOTE]
> The above command will not work with the AppImage or Flatpak packages. Please refer to the
> [AppImage setup](md_docs_2getting__started.html#appimage) or
> [Flatpak setup](md_docs_2getting__started.html#flatpak) for more specific instructions.
> The above commands will not work with the AppImage or Flatpak packages, as KMS screencasting
> requires elevated privileges which are not allowed by their respective packaging security policies.
> As an alternative, XDG Portal capture is recommended.

### KMS streaming fails on Nvidia GPUs
If KMS screen capture results in a black screen being streamed, you may need to
Expand Down
4 changes: 4 additions & 0 deletions packaging/linux/00-sunshine-kms.preset.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# @PROJECT_DESCRIPTION@
# KMS service should preset to disabled

disable sunshine-kms.service
2 changes: 0 additions & 2 deletions packaging/linux/AppImage/AppRun
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ function install() {
cp -r "$SUNSHINE_SHARE_HERE/systemd/user/" ~/.config/systemd/
# patch service executable path
sed -i -e "s#$SUNSHINE_PATH#$(readlink -f $ARGV0)#g" ~/.config/systemd/user/sunshine.service
sed -i -e "s#$SUNSHINE_PATH#$(readlink -f $ARGV0)#g" ~/.config/systemd/user/sunshine-kms.service

# setcap
sudo setcap cap_sys_admin+p "$(readlink -f "$SUNSHINE_BIN_HERE")"
Expand All @@ -73,7 +72,6 @@ function remove() {

# remove service
sudo rm -f ~/.config/systemd/user/sunshine.service
sudo rm -f ~/.config/systemd/user/sunshine-kms.service
}

# process arguments
Expand Down
3 changes: 2 additions & 1 deletion packaging/linux/copr/Sunshine.spec
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@ fi
%caps(cap_sys_admin+p) %{_bindir}/sunshine
%caps(cap_sys_admin+p) %{_bindir}/sunshine-*

# Systemd unit files for user services
# Systemd unit/preset files for user services
%{_userunitdir}/sunshine.service
%{_userunitdir}/sunshine-kms.service
%{_userpresetdir}/00-sunshine-kms.preset

# Udev rules
%{_udevrulesdir}/*-sunshine.rules
Expand Down
4 changes: 0 additions & 4 deletions packaging/linux/dev.lizardbyte.app.Sunshine.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
<code>flatpak run --command=additional-install.sh @PROJECT_FQDN@</code>
</p>
<p>NOTE: Sunshine uses a self-signed certificate. The web browser will report it as not secure, but it is safe.</p>
<p>NOTE: KMS Grab (Flatpak)</p>
<p>
<code>sudo -i PULSE_SERVER=unix:/run/user/$(id -u $whoami)/pulse/native flatpak run @PROJECT_FQDN@</code>
</p>
</description>

<releases>
Expand Down
5 changes: 2 additions & 3 deletions packaging/linux/flatpak/scripts/additional-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
# User Service
mkdir -p ~/.config/systemd/user
cp "/app/share/sunshine/systemd/user/sunshine.service" "$HOME/.config/systemd/user/sunshine.service"
cp "/app/share/sunshine/systemd/user/sunshine-kms.service" "$HOME/.config/systemd/user/sunshine-kms.service"
echo "Sunshine User Services have been installed."
echo "Use [systemctl --user enable sunshine] or [systemctl --user enable sunshine-kms] once to autostart Sunshine on login."
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)
Expand Down
3 changes: 1 addition & 2 deletions packaging/linux/flatpak/scripts/remove-additional-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
# User Service
systemctl --user stop sunshine
rm "$HOME/.config/systemd/user/sunshine.service"
rm "$HOME/.config/systemd/user/sunshine-kms.service"
systemctl --user daemon-reload
echo "Sunshine User Services have been removed."
echo "Sunshine User Service has been removed."

# Remove rules
flatpak-spawn --host pkexec sh -c "rm /etc/modules-load.d/60-sunshine.conf"
Expand Down
Loading