How can I tell if my package is being upgraded in a flat package postinstall script?

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

  •  07-06-2021
  •  | 
  •  

Pergunta

I have a Mac OS X flat package that runs a postinstall script. I would like to know in the script if it's a new install or an upgrade. Bundle-style packages have pre and postupgrade scripts but I can't use a bundle package.

I've dumped out the environment variables in the script and I've dumped the arguments to the script itself and none of these seem to indicate if it's an upgrade or install. I can tell that Installer knows because the Installer Log indicates install or upgrade. I just don't know how to tell from the postinstall script.

Foi útil?

Solução

If it's your package, why don't you check for signs that you're already on the machine? Either leave some marker that will tell you that you've already been installed or check if your old files are present on the disk before deployment?

Outras dicas

If your package is installed for the first time Installer will call postinstall script but if it is upgraded, it should call postupgrade script.

More information here in the What About script section.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top