How do you include a preinstall script in an installer built via the packagemaker shell command?

StackOverflow https://stackoverflow.com/questions/4015979

  •  26-09-2019
  •  | 
  •  

Question

I'm creating an installer via the packagemaker command as part of a script. I create the folder hierarchy in stagedRootPath and then use the --root parameter to build the installer. The problem is that I want to install things in the installing user's home directory, which I don't know when I build the installer. I doubt you can have some sort of variables substitution in the install path if you use the --root option.

My workaround idea is to have a preflight script creates a symlink to the current user's home directory and install the files through that (ie. ln -s ~ /tmp/home). I know how to include a script via the GUI PackageMaker app, but I can't use that as this is part of a script.

Is there a way to include it via the command? Do I have to use a .pmdoc or can I avoid it? If I have to use a pmdoc, can I create it programmatically?

Other solutions to installing in the install-time home directory are welcome.

# my install command
packagemaker --root stagedRootPath -id com.myinstaller --title myInstallerTitle
Was it helpful?

Solution

Turns out you can do this by putting scripts into a folder with the correct names and using the --scripts option.

 preflight
 preinstall    or preupgrade
 postinstall   or postupgrade
 postflight

(More details in the man page.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top