From 805fa791d10c31ba629306328c2f491708e3e88b Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Mon, 12 Jul 2021 06:09:35 +0300 Subject: CPack/DEB: Avoid overriding user-provided `postinst` and `postrm` When a user provides `CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA` or `CPACK_DEBIAN__PACKAGE_CONTROL_EXTRA` variables in `CMakeLists.txt` and the package contains dynamic libraries, the `CPackDeb.cmake` sets `CPACK_ADD_LDCONFIG_CALL` to `1`. Later it analyzes if defaulted `postinst`/`postrm` should be generated trying to check if the user provides any in `CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA` variable. However, the `foreach` loop uses the invalid variable `PACKAGE_CONTROL_EXTRA` instead, so these files gonna be overridden. Fix the variable name. Fixes: #22410 --- Modules/Internal/CPack/CPackDeb.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index 2ceab10..967ad7b 100644 --- a/Modules/Internal/CPack/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -673,7 +673,7 @@ function(cpack_deb_prepare_package_vars) if(CPACK_ADD_LDCONFIG_CALL) set(CPACK_DEBIAN_GENERATE_POSTINST 1) set(CPACK_DEBIAN_GENERATE_POSTRM 1) - foreach(f IN LISTS PACKAGE_CONTROL_EXTRA) + foreach(f IN LISTS CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA) get_filename_component(n "${f}" NAME) if(n STREQUAL "postinst") set(CPACK_DEBIAN_GENERATE_POSTINST 0) -- cgit v0.12