I got a pkg file in which I can change the installation directory when launched using the UI, but the manpage of installer only mention the target drive to install to.
Is there an environement variable to set when calling the installer ?
About the target options, from installer help :
The -target <device> parameter is any one of the following: (1) One of the domains returned by -dominfo. (2) Device node entry. Any entry of the form of /dev/disk*. ex: /dev/disk2 (3) The disk identifier. Any entry of the form of disk*. ex: disk1s9 (4) Volume mount point. Any entry of the form of /Volumes/Mountpoint. ex: /Volumes/Untitled (5) Volume UUID. ex: 376C4046-083E-334F-AF08-62FAFBC4E352
So target is a "hard drive", not the "root path" where the pkg should be installed.
Your question is quite unclear: If you run the installer from the GUI and there is only one drive offered to install to, you can not change it in an easy way (means: you have to make changes to the installer package to install in a different location than offered by default).
Since you are using the "cli"-Tag (command line interface), I think you are trying to run the installer not on the GUI, instead you are running it from the terminal. There you have more options: With the -target option, you can set the installpath for your installer.
Information from the man-pages on the -target-Option:
The target volume is specified with the -target parameter ( -tgt is accepted as a synonym). It must already be mounted when the installer command is invoked.
Additional informations on how to run an installer from the Terminal (cli), you will find on my blog.