CPack/DEB: User provided `postinst` and `postrm` get overwritten
When a user provides CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
or CPACK_DEBIAN_<comp>_PACKAGE_CONTROL_EXTRA
variables in CMakeLists.txt
and the package contains dynamic libraries, the CPackDeb.cmake
sets CPACK_ADD_LDCONFIG_CALL
to 1
(line 699). 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, cuz CPACK_DEBIAN_GENERATE_POSTINST
and CPACK_DEBIAN_GENERATE_POSTRM
preset to 1
right before the loop, which is never executed.
As far as I see, this code always was incorrect since added in c7f388e7.
Edited by Alex Turbov