@@ -36,6 +36,12 @@ elseif (NOT _LIBDIR)
endif ()
+if (NOT _POLKIT_INSTALL_PREFIX)
+
+ set(_POLKIT_INSTALL_PREFIX "/usr")
+
+endif ()
+
set(CMAKE_MODULE_PATH "${KS_DIR}/build")
find_package(TraceEvent REQUIRED)
find_package(TraceFS REQUIRED)
@@ -1 +1,9 @@
-sudo cmake -DCOMPONENT=kernelshark -P cmake_install.cmake
+if sudo cmake -DCOMPONENT=kernelshark -P cmake_install.cmake; then
+ echo "Kernelshark installed correctly"
+else
+ exit 1
+fi
+
+if ! sudo cmake -DCOMPONENT=polkit-policy -P cmake_install.cmake; then
+ echo >&2 "Warning: polkit policy not installed"
+fi
@@ -127,8 +127,8 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND AND TT_FONT_FILE)
COMPONENT kernelshark)
install(FILES "${KS_DIR}/org.freedesktop.kshark-record.policy"
- DESTINATION /usr/share/polkit-1/actions/
- COMPONENT kernelshark)
+ DESTINATION ${_POLKIT_INSTALL_PREFIX}/share/polkit-1/actions/
+ COMPONENT polkit-policy)
install(PROGRAMS "${KS_DIR}/bin/kshark-su-record"
DESTINATION ${_INSTALL_PREFIX}/bin/
For a polkit policy to be found by polkit daemon, it must be installed to a single system-wide location, typically /usr/share/polkit-1/actions. CMakeLists file reflects that and always installs the policy under /usr. But when one wants to install kernel-shark to a non-standard location, e.g., by configuring it as follows: cmake -D_INSTALL_PREFIX=$HOME ... then "make install" fails, with the following error: CMake Error at src/cmake_install.cmake:225 (file): file INSTALL cannot copy file "/home/user/src/trace-cmd/kernel-shark/org.freedesktop.kshark-record.policy" to "/usr/share/polkit-1/actions/org.freedesktop.kshark-record.policy". This commit fixes that by changing two things: - custom location where to install polkit policy can be specified via cmake command line argument -D_POLKIT_INSTALL_PREFIX=... This will also help distributions where polkit is configured with different prefix than /usr. - polkit policy is now a separate cmake component, which can be installed separately from the rest. The later allows generating better messages for the user to understand that the failed polkit policy installation is not a critical error. Signed-off-by: Michal Sojka <michal.sojka@cvut.cz> --- CMakeLists.txt | 6 ++++++ build/install_gui.sh | 10 +++++++++- src/CMakeLists.txt | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-)