Thank you so much Eric, yes I'll use rpm post/pre install script for
rpm package and put the generic solution worry aside for the time
being.

Cheers.

Jupiter

On 7/10/12, Eric Noulard <[email protected]> wrote:
> 2012/7/10 jupiter <[email protected]>:
>> Hi,
>>
>> I need to run shell script to do following check and to install
>> configure files during RPM installation:
>>
>> if config files installed in /etc/myconfig, rename files in
>> /etc/myconfig and copy new config files to /etc/myconfig;
>> else copy config files to /etc/myconfig
>>
>> Is there a simple way to do it?
>
> If you flag your config file with %config, then RPM should do just that.
> If you use %config,(noreplace) then the old config file will be kept
> and the new installed
> with extra .rpmnew extension.
>
> for that you can do:
> set(CPACK_RPM_USER_FILELIST "%config /etc/myconfig")
>
> if you use component packaging then
> set(CPACK_RPM_<COMPONENT>_USER_FILELIST  "%config /etc/myconfig")
>
> see:
> cpack --help-variable CPACK_RPM_USER_FILELIST
>
>> I am not clear if the install(SCRIPT
>> ...) can be used, I guess the cmake script can be invoked during
>> installation to call execute_process() for bash shell commands, but
>> where I can copy my configuration source files from?
>
> Invoking cmake at package install time (when rpm runs) may fail because
> cmake
> is not there. Usually rpm post/pre [un]install script are bare shell
> script.
>
> You can insert such scripts with CPackRPM using
> CPACK_RPM_POST_INSTALL_SCRIPT_FILE
> CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
>
> cpack --help-variable CPACK_RPM_POST_INSTALL_SCRIPT_FILE
> cpack --help-variable CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
>
>
> The general solution for "portable" pre/post install script is an open
> issue:
> http://www.cmake.org/pipermail/cmake/2012-April/050045.html
> --
> Erk
> Le gouvernement représentatif n'est pas la démocratie --
> http://www.le-message.org
>
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to