fix(linux): use FQDN naming for all Linux packaging types (#4779)

Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
This commit is contained in:
Conn O'Griofa
2026-03-07 19:15:50 +00:00
committed by GitHub
parent 76c3463d2c
commit daa99db662
16 changed files with 65 additions and 81 deletions
-5
View File
@@ -217,12 +217,7 @@ if(${SUNSHINE_ENABLE_TRAY})
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES ${APPINDICATOR_LIBRARIES} ${LIBNOTIFY_LIBRARIES})
endif()
# flatpak icons must be prefixed with the app id or they will not be included in the flatpak
if(${SUNSHINE_BUILD_FLATPAK})
set(SUNSHINE_TRAY_PREFIX "${PROJECT_FQDN}")
else()
set(SUNSHINE_TRAY_PREFIX "sunshine")
endif()
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_TRAY_PREFIX="${SUNSHINE_TRAY_PREFIX}")
else()
set(SUNSHINE_TRAY 0)
+7 -25
View File
@@ -16,11 +16,11 @@ if(${SUNSHINE_BUILD_APPIMAGE} OR ${SUNSHINE_BUILD_FLATPAK})
DESTINATION "${SUNSHINE_ASSETS_DIR}/udev/rules.d")
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/60-sunshine.conf"
DESTINATION "${SUNSHINE_ASSETS_DIR}/modules-load.d")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/app-${PROJECT_FQDN}.service"
DESTINATION "${SUNSHINE_ASSETS_DIR}/systemd/user")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
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"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/00-app-${PROJECT_FQDN}.preset"
DESTINATION "${SUNSHINE_ASSETS_DIR}/systemd/user-preset")
else()
find_package(Systemd)
@@ -31,11 +31,11 @@ else()
DESTINATION "${UDEV_RULES_INSTALL_DIR}")
endif()
if(SYSTEMD_FOUND)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/app-${PROJECT_FQDN}.service"
DESTINATION "${SYSTEMD_USER_UNIT_INSTALL_DIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
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"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/00-app-${PROJECT_FQDN}.preset"
DESTINATION "${SYSTEMD_USER_PRESET_INSTALL_DIR}")
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/60-sunshine.conf"
DESTINATION "${SYSTEMD_MODULES_LOAD_DIR}")
@@ -143,29 +143,12 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_RPM_PACKAGE_AUTOREQ ON)
# application icon
if(NOT ${SUNSHINE_BUILD_FLATPAK})
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps")
else()
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps"
RENAME "${PROJECT_FQDN}.svg")
endif()
# tray icon
if(${SUNSHINE_TRAY} STREQUAL 1)
if(NOT ${SUNSHINE_BUILD_FLATPAK})
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
RENAME "sunshine-tray.svg")
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-playing.svg"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status")
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-pausing.svg"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status")
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-locked.svg"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status")
else()
# flatpak icons must be prefixed with the app id or they will not be included in the flatpak
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
RENAME "${PROJECT_FQDN}-tray.svg")
@@ -178,7 +161,6 @@ if(${SUNSHINE_TRAY} STREQUAL 1)
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-locked.svg"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
RENAME "${PROJECT_FQDN}-locked.svg")
endif()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
+2
View File
@@ -127,6 +127,7 @@ endif()
math(EXPR RC_VERSION_BUILD "${PROJECT_VERSION_PATCH} / 100")
math(EXPR RC_VERSION_REVISION "${PROJECT_VERSION_PATCH} % 100")
message("PROJECT_FQDN: ${PROJECT_FQDN}")
message("PROJECT_NAME: ${PROJECT_NAME}")
message("PROJECT_VERSION: ${PROJECT_VERSION}")
message("PROJECT_VERSION_MAJOR: ${PROJECT_VERSION_MAJOR}")
@@ -142,6 +143,7 @@ message("PROJECT_YEAR: ${PROJECT_YEAR}")
message("PROJECT_MONTH: ${PROJECT_MONTH}")
message("PROJECT_DAY: ${PROJECT_DAY}")
list(APPEND SUNSHINE_DEFINITIONS PROJECT_FQDN="${PROJECT_FQDN}")
list(APPEND SUNSHINE_DEFINITIONS PROJECT_NAME="${PROJECT_NAME}")
list(APPEND SUNSHINE_DEFINITIONS PROJECT_VERSION="${PROJECT_VERSION}")
list(APPEND SUNSHINE_DEFINITIONS PROJECT_VERSION_MAJOR="${PROJECT_VERSION_MAJOR}")
@@ -10,11 +10,10 @@ if(APPLE)
endif()
elseif(UNIX)
# configure the .desktop file
set(SUNSHINE_DESKTOP_ICON "sunshine")
set(SUNSHINE_DESKTOP_ICON "${PROJECT_FQDN}")
if(${SUNSHINE_BUILD_APPIMAGE})
configure_file(packaging/linux/AppImage/${PROJECT_FQDN}.desktop ${PROJECT_FQDN}.desktop @ONLY)
elseif(${SUNSHINE_BUILD_FLATPAK})
set(SUNSHINE_DESKTOP_ICON "${PROJECT_FQDN}")
configure_file(packaging/linux/flatpak/${PROJECT_FQDN}.desktop ${PROJECT_FQDN}.desktop @ONLY)
else()
configure_file(packaging/linux/${PROJECT_FQDN}.desktop ${PROJECT_FQDN}.desktop @ONLY)
@@ -25,9 +24,9 @@ elseif(UNIX)
configure_file(packaging/linux/${PROJECT_FQDN}.metainfo.xml ${PROJECT_FQDN}.metainfo.xml @ONLY)
# configure service
configure_file(packaging/linux/app-${PROJECT_FQDN}.service.in app-${PROJECT_FQDN}.service @ONLY)
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_file(packaging/linux/00-app-${PROJECT_FQDN}.preset.in 00-app-${PROJECT_FQDN}.preset @ONLY)
# configure the arch linux pkgbuild
if(${SUNSHINE_CONFIGURE_PKGBUILD})
+4 -4
View File
@@ -448,17 +448,17 @@ After adding yourself to the group, log out and log back in for the changes to t
#### Services
> [!NOTE]
> Two service unit files are available. Pick "sunshine" for unprivileged XDG Portal or X11 capture, otherwise
> pick "sunshine-kms" for privileged KMS capture.
> Two service unit files are available. Pick "app-dev.lizardbyte.app.Sunshine" for unprivileged XDG Portal
> or X11 capture, otherwise pick "sunshine" for privileged KMS capture.
**Start once**
```bash
systemctl --user start sunshine
```
**Start on boot (unprivileged; swap logic for KMS)**
**Start on boot (privileged; swap names for unprivileged XDG capture)**
```bash
systemctl --user --now disable sunshine-kms
systemctl --user --now disable app-dev.lizardbyte.app.Sunshine
systemctl --user --now enable sunshine
```
+4 -4
View File
@@ -160,12 +160,12 @@ sudo usermod -aG input $USER
```
### KMS Streaming fails
If screencasting fails with KMS, you may be using the unprivileged sunshine service unit. Switch to the privileged
sunshine-kms service:
If screencasting fails with KMS, you may be using the unprivileged app-dev.lizardbyte.app.Sunshine service unit.
Switch to the privileged sunshine service:
```bash
systemctl --user --now disable sunshine
systemctl --user --now enable sunshine-kms
systemctl --user --now disable app-dev.lizardbyte.app.Sunshine
systemctl --user --now enable sunshine
```
> [!NOTE]
@@ -0,0 +1,4 @@
# @PROJECT_DESCRIPTION@
# The unprivileged service should preset to disabled
disable app-@PROJECT_FQDN@.service
@@ -1,4 +0,0 @@
# @PROJECT_DESCRIPTION@
# KMS service should preset to disabled
disable sunshine-kms.service
+2 -2
View File
@@ -57,7 +57,7 @@ function install() {
mkdir -p ~/.config/systemd/user
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/app-dev.lizardbyte.app.Sunshine.service
# setcap
sudo setcap cap_sys_admin+p "$(readlink -f "$SUNSHINE_BIN_HERE")"
@@ -71,7 +71,7 @@ function remove() {
sudo rm -f /etc/modules-load.d/60-sunshine.conf
# remove service
sudo rm -f ~/.config/systemd/user/sunshine.service
sudo rm -f ~/.config/systemd/user/app-dev.lizardbyte.app.Sunshine.service
}
# process arguments
@@ -3,7 +3,7 @@ Description=@PROJECT_DESCRIPTION@
StartLimitIntervalSec=500
StartLimitBurst=5
Conflicts=sunshine.service
After=graphical-session.target xdg-desktop-autostart.target
After=graphical-session.target xdg-desktop-autostart.target xdg-desktop-portal.service
[Service]
# Avoid starting Sunshine before the desktop is fully initialized.
@@ -12,6 +12,7 @@ ExecStartPre=/bin/sleep 5
@SUNSHINE_SERVICE_STOP_COMMAND@
Restart=on-failure
RestartSec=5s
NoNewPrivileges=true
[Install]
WantedBy=graphical-session.target
+4 -5
View File
@@ -386,9 +386,8 @@ fi
%caps(cap_sys_admin+p) %{_bindir}/sunshine-*
# Systemd unit/preset files for user services
%{_userunitdir}/sunshine.service
%{_userunitdir}/sunshine-kms.service
%{_userpresetdir}/00-sunshine-kms.preset
%{_userunitdir}/*.service
%{_userpresetdir}/*.preset
# Udev rules
%{_udevrulesdir}/*-sunshine.rules
@@ -400,8 +399,8 @@ fi
%{_datadir}/applications/*.desktop
# Icons
%{_datadir}/icons/hicolor/scalable/apps/sunshine.svg
%{_datadir}/icons/hicolor/scalable/status/sunshine*.svg
%{_datadir}/icons/hicolor/scalable/apps/*.Sunshine.svg
%{_datadir}/icons/hicolor/scalable/status/*.Sunshine-*.svg
# Metainfo
%{_datadir}/metainfo/*.metainfo.xml
@@ -4,6 +4,7 @@ Categories=RemoteAccess;Network;
Comment=@PROJECT_DESCRIPTION@
Exec=/usr/bin/env systemctl start --u sunshine
Icon=@SUNSHINE_DESKTOP_ICON@
StartupWMClass=@PROJECT_FQDN@
Keywords=gamestream;stream;moonlight;remote play;
Name=@PROJECT_NAME@
Type=Application
@@ -2,9 +2,9 @@
# 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/app-dev.lizardbyte.app.Sunshine.service" "$HOME/.config/systemd/user/app-dev.lizardbyte.app.Sunshine.service"
echo "Sunshine User Service has been installed."
echo "Use [systemctl --user enable sunshine] once to autostart Sunshine on login."
echo "Use [systemctl --user enable app-dev.lizardbyte.app.Sunshine] once to autostart Sunshine on login."
# Load uhid (DS5 emulation)
UHID=$(cat /app/share/sunshine/modules-load.d/60-sunshine.conf)
@@ -1,8 +1,8 @@
#!/bin/sh
# User Service
systemctl --user stop sunshine
rm "$HOME/.config/systemd/user/sunshine.service"
systemctl --user stop app-dev.lizardbyte.app.Sunshine
rm "$HOME/.config/systemd/user/app-dev.lizardbyte.app.Sunshine.service"
systemctl --user daemon-reload
echo "Sunshine User Service has been removed."
+2 -3
View File
@@ -2,8 +2,8 @@
Description=@PROJECT_DESCRIPTION@
StartLimitIntervalSec=500
StartLimitBurst=5
Conflicts=sunshine-kms.service
After=graphical-session.target xdg-desktop-autostart.target xdg-desktop-portal.service
Conflicts=app-@PROJECT_FQDN@.service
After=graphical-session.target xdg-desktop-autostart.target
[Service]
# Avoid starting Sunshine before the desktop is fully initialized.
@@ -12,7 +12,6 @@ ExecStartPre=/bin/sleep 5
@SUNSHINE_SERVICE_STOP_COMMAND@
Restart=on-failure
RestartSec=5s
NoNewPrivileges=true
[Install]
WantedBy=graphical-session.target
+11 -5
View File
@@ -1681,14 +1681,20 @@ namespace platf {
if (!fb->handles[0]) {
BOOST_LOG(error) << "Couldn't get handle for DRM Framebuffer ["sv << plane->fb_id << "]: Probably not permitted"sv;
BOOST_LOG((config::video.capture == "kms") ? fatal : error)
#if defined(SUNSHINE_BUILD_FLATPAK) || defined(SUNSHINE_BUILD_APPIMAGE)
BOOST_LOG((config::video.capture == "kms") ? fatal : error)
<< "AppImage and Flatpak do not support KMS capture. Use another capture method."sv;
#else
<< "You must use the 'sunshine-kms' service instead of the 'sunshine' service for KMS capture.\n"sv
<< "Please refer to the official documentation:\n"sv
<< " stable: https://docs.lizardbyte.dev/projects/sunshine/latest/md_docs_2getting__started.html#linux-1"sv
<< " beta: https://docs.lizardbyte.dev/projects/sunshine/master/md_docs_2getting__started.html#linux-1"sv;
{
const std::string kms_msg =
"You must use the 'sunshine' service instead of the 'app-" +
std::string(PROJECT_FQDN) +
"' service for KMS capture.\n"
"Please refer to the official documentation:\n"
" stable: https://docs.lizardbyte.dev/projects/sunshine/latest/md_docs_2getting__started.html#linux-1\n"
" beta: https://docs.lizardbyte.dev/projects/sunshine/master/md_docs_2getting__started.html#linux-1";
BOOST_LOG((config::video.capture == "kms") ? fatal : error) << kms_msg;
}
#endif
break;
}