[CMake] CPack: setting multiple RPM pre/post (un)install scripts

Thomas Teo t.teo at acfr.usyd.edu.au
Sun May 29 18:44:45 EDT 2016


Hi All,
In building an RPM package, I'd like to set multiple (un)install scripts 
- an application specific one which starts services that are installed 
by the RPM, and also to call ldconfig so that the shared library list is 
updated. The CMake/CPack documentation states this is supported (eg 
https://cmake.org/cmake/help/v3.0/module/CPackRPM.html):

    May be used to embed a pre (un)installation script in the spec file.
    The refered (sic) script file*(s)* will be read...
    (my emphasis)

However the example doesn't indicate how one would specify multiple 
script files. I've tried several different methods:

    SET(CPACK_RPM_POST_INSTALL_SCRIPT_FILE
    "${CMAKE_SOURCE_DIR}/a.sh;${CMAKE_SOURCE_DIR}/b.sh" )
    SET(CPACK_RPM_POST_INSTALL_SCRIPT_FILE
    "${CMAKE_SOURCE_DIR}/a.sh,${CMAKE_SOURCE_DIR}/b.sh" )
    SET(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/a.sh"
    "${CMAKE_SOURCE_DIR}/b.sh" )
    SET(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/a.sh
    ${CMAKE_SOURCE_DIR}/b.sh" )


Which often result in the error:

    CMake Error at /usr/share/cmake-3.4/Modules/CPackRPM.cmake:1377 (if):
       if given arguments:

         "EXISTS" "/home/thomas/src/<project>/a.sh"
    "/home/thomas/src/<project>/b.sh"

Looking at the CMake code in the referenced file (CPackRPM.cmake) it 
appears that it could never handle multiple script files as there is no 
iteration.
Is it possible the documentation is in error and only one script for 
each type of action (pre/post, un/install) can be specified?

All assistance appreciated.

Cheers,
Thomas

-- 
Thomas Teo
Australian Centre for Field Robotics
The University of Sydney

t.teo at acfr.usyd.edu.au
www.acfr.usyd.edu.au



More information about the CMake mailing list