Passing arguments or environment to Mac installer script

I tried to write an installer with a packer that runs a shell script during installation. I want to pass some arguments to the shell script during silent installation. Something like

$installer -pkg MyInstaller.pkg -my_argument1 -my_argument2 

Two options I can think of are

  • Set the environment variables and read them from the script. But this does not seem to work.
  • Write this data to some file and read it during installation. But this is a very ugly way to do this, and it is not convenient for my installer user.

Is there a better way to do this with command line arguments or environments?

+4
source share

Source: https://habr.com/ru/post/1388301/


All Articles