[CMake] CPack : Executing post install script (portable way)

Eric Noulard eric.noulard at gmail.com
Thu Apr 26 06:10:16 EDT 2012


2012/4/26 Nicholas Yue <yue.nicholas at gmail.com>:
> Hi,
>
>  What is the proper way to execute a post install script in NSIS,
> PackageMaker and sh-archive ?

Currently there is no way to do that.
And I'd say that portable "package install time" script execution is
not easy at all.

When the package is installed (NSIS, PackageMaker, sh-archive, RPM, Deb)
you have no insurance whatsoever of the script engine you will have at hand
but the one usually used by the package manager itself:
    NSIS --> NSIS script
    PackageMaker --> I don't know that one
    sh-archive --> shell
    RPM --> shell
    Deb --> shell

How would you create a portable package-install time script with that?

>  From reading the
> http://www.vtk.org/Wiki/CMake:CPackPackageGenerators, it seems
> different package generator has different ways.

Yes true, and some package generators like pure archive ones (ZIP,
TGZ, TBZ2) do not
event have a pre-/post-/whatever package install script capability.

>  My immediate need is to run a batch script for NSIS at a known
> location (relative to the actual installed path i.e. I am taking into
> account the user may choose a different installation from the standard
> path).
>
>  Is CPACK_NSIS_MUI_FINISHPAGE_RUN suitable ? How does CPack/NSIS
> determine the path to that script/executable ?

I don't know may be you can have a look at the source code and propose
a documentation patch :-]
Seriously, I'll pass I'm not using it, may be someone here knows that.

>
>  How do I determined (within CMake/CPack) the installation directory
> chosen by the user ?

For package with user chosable location (or relocation) you don't have
access to this information
at CMake or CPack level because CPack nor CMake will be running at that time.

You may have access to this infos from within the installer specific
scripting language if any.
Shell variable for RPM for example, may be some NSIS var for NSIS etc...

Remember that CMake/CPack defines 5 "times":

1) CMake time: CMake is running & processing CMakeLists.txt
2) Build time: the build tool runs and invokes (at least) the compiler
3) Install time: the compiled binaries are installed i.e. from build
area to an install location.
4) CPack time: CPack is running for building package
5) Package Install time: the package (from previous step) is installed

not all informations can be available or exchanged between those
separate "times".


-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list