Find the correct install paths for systemd units and udev rules (#2046)
This commit is contained in:
34
cmake/FindSystemd.cmake
Normal file
34
cmake/FindSystemd.cmake
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# - Try to find Systemd
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# SYSTEMD_FOUND - system has systemd
|
||||||
|
# SYSTEMD_USER_UNIT_INSTALL_DIR - the systemd system unit install directory
|
||||||
|
# SYSTEMD_SYSTEM_UNIT_INSTALL_DIR - the systemd user unit install directory
|
||||||
|
|
||||||
|
IF (NOT WIN32)
|
||||||
|
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if(PKG_CONFIG_FOUND)
|
||||||
|
pkg_check_modules(SYSTEMD "systemd")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (SYSTEMD_FOUND)
|
||||||
|
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
|
||||||
|
--variable=systemduserunitdir systemd
|
||||||
|
OUTPUT_VARIABLE SYSTEMD_USER_UNIT_INSTALL_DIR)
|
||||||
|
|
||||||
|
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_USER_UNIT_INSTALL_DIR
|
||||||
|
"${SYSTEMD_USER_UNIT_INSTALL_DIR}")
|
||||||
|
|
||||||
|
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
|
||||||
|
--variable=systemdsystemunitdir systemd
|
||||||
|
OUTPUT_VARIABLE SYSTEMD_SYSTEM_UNIT_INSTALL_DIR)
|
||||||
|
|
||||||
|
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_SYSTEM_UNIT_INSTALL_DIR
|
||||||
|
"${SYSTEMD_SYSTEM_UNIT_INSTALL_DIR}")
|
||||||
|
|
||||||
|
mark_as_advanced(SYSTEMD_USER_UNIT_INSTALL_DIR SYSTEMD_SYSTEM_UNIT_INSTALL_DIR)
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
ENDIF ()
|
||||||
28
cmake/FindUdev.cmake
Normal file
28
cmake/FindUdev.cmake
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# - Try to find Udev
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# UDEV_FOUND - system has udev
|
||||||
|
# UDEV_RULES_INSTALL_DIR - the udev rules install directory
|
||||||
|
|
||||||
|
IF (NOT WIN32)
|
||||||
|
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if(PKG_CONFIG_FOUND)
|
||||||
|
pkg_check_modules(UDEV "udev")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (UDEV_FOUND)
|
||||||
|
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
|
||||||
|
--variable=udevdir udev
|
||||||
|
OUTPUT_VARIABLE UDEV_RULES_INSTALL_DIR)
|
||||||
|
|
||||||
|
string(REGEX REPLACE "[ \t\n]+" "" UDEV_RULES_INSTALL_DIR
|
||||||
|
"${UDEV_RULES_INSTALL_DIR}")
|
||||||
|
|
||||||
|
set(UDEV_RULES_INSTALL_DIR "${UDEV_RULES_INSTALL_DIR}/rules.d")
|
||||||
|
|
||||||
|
mark_as_advanced(UDEV_RULES_INSTALL_DIR)
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
ENDIF ()
|
||||||
@@ -8,10 +8,13 @@ if(${SUNSHINE_BUILD_APPIMAGE} OR ${SUNSHINE_BUILD_FLATPAK})
|
|||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
|
||||||
DESTINATION "${SUNSHINE_ASSETS_DIR}/systemd/user")
|
DESTINATION "${SUNSHINE_ASSETS_DIR}/systemd/user")
|
||||||
else()
|
else()
|
||||||
|
find_package(Systemd)
|
||||||
|
find_package(Udev)
|
||||||
|
|
||||||
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine.rules"
|
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine.rules"
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/udev/rules.d")
|
DESTINATION "${UDEV_RULES_INSTALL_DIR}")
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/systemd/user")
|
DESTINATION "${SYSTEMD_USER_UNIT_INSTALL_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Post install
|
# Post install
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ apt-get install -y --no-install-recommends \
|
|||||||
libxtst-dev \
|
libxtst-dev \
|
||||||
nodejs \
|
nodejs \
|
||||||
npm \
|
npm \
|
||||||
|
udev \
|
||||||
wget
|
wget
|
||||||
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ apt-get install -y --no-install-recommends \
|
|||||||
libxfixes-dev \
|
libxfixes-dev \
|
||||||
libxrandr-dev \
|
libxrandr-dev \
|
||||||
libxtst-dev \
|
libxtst-dev \
|
||||||
|
udev \
|
||||||
wget
|
wget
|
||||||
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ apt-get install -y --no-install-recommends \
|
|||||||
libxfixes-dev \
|
libxfixes-dev \
|
||||||
libxrandr-dev \
|
libxrandr-dev \
|
||||||
libxtst-dev \
|
libxtst-dev \
|
||||||
|
udev \
|
||||||
wget
|
wget
|
||||||
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ apt-get install -y --no-install-recommends \
|
|||||||
libxfixes-dev \
|
libxfixes-dev \
|
||||||
libxrandr-dev \
|
libxrandr-dev \
|
||||||
libxtst-dev \
|
libxtst-dev \
|
||||||
|
udev \
|
||||||
wget
|
wget
|
||||||
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
|||||||
Reference in New Issue
Block a user