Skip to content

Commit a6f58e9

Browse files
committed
Install to /lib/systemd/system-sleep if the distribution patches systemd
This fixes suspend behaviour on Ubuntu Fixes milgner#16
1 parent 0a70b6a commit a6f58e9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,15 @@ if(INSTALL_UDEV_RULE)
2828
endif()
2929
if(INSTALL_SYSTEMD_SLEEP_SCRIPT)
3030
configure_file(k290-fnkeyctl.sh.in ${CMAKE_CURRENT_BINARY_DIR}/k290-fnkeyctl.sh @ONLY)
31-
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/k290-fnkeyctl.sh DESTINATION /usr/lib/systemd/system-sleep/)
31+
if(IS_DIRECTORY /usr/lib/systemd/system-sleep/)
32+
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/k290-fnkeyctl.sh DESTINATION /usr/lib/systemd/system-sleep/)
33+
endif()
34+
# some distributions (e.g. Ubuntu) patch systemd to use /lib/systemd/system-sleep/ instead
35+
if(IS_DIRECTORY /lib/systemd/system-sleep/)
36+
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/k290-fnkeyctl.sh DESTINATION /lib/systemd/system-sleep/)
37+
endif()
3238
endif()
39+
3340
if(INSTALL_PM_UTILS_SLEEP_SCRIPT)
3441
configure_file(20-k290.sh.in ${CMAKE_CURRENT_BINARY_DIR}/20-k290.sh @ONLY)
3542
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/20-k290.sh DESTINATION /etc/pm/sleep.d/)

0 commit comments

Comments
 (0)