[CMake] Post install scripts for debian

Eric Noulard eric.noulard at gmail.com
Fri Oct 16 14:15:02 EDT 2009


2009/10/16 as <rmctodd at gmail.com>:
> Hello:
>
> We are using CMake to create inhouse deb packages for our project. We
> need to run a script after installing the package: postinst script
> which is possible in Debian. I don't know how to enable this from
> CMake - do I set some flags? Do I just put the file in a particular
> location? I'm not able to find much help on the web.

Normally information about CPack generator may be found on the Wiki
 http://www.cmake.org/Wiki/CMake:CPackPackageGenerators

now when you cannot find information there you can try inside CPack
source or CPack module:

CPackDeb.cmake is the one for Deb packaging which defines DEB
specific variable usage.
The one which may satisty your need is:

# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
# This variable allow advanced user to add custom script to the
control.tar.gz (inside the .deb archive)
# Typical examples are:
# - conffiles
# - postinst
# - postrm
# - prerm"
# Usage:
# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
#    "${CMAKE_CURRENT_SOURCE_DIR}/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")

Thus I would say that if you
SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA <yourpath_to>/postinst)

it should work as expected.
If it does may you can update the DEB part of the wiki accordingly:

http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list