Packages Suitable for Deployment - MagerValp/AutoDMG GitHub Wiki
Packages normally assume that they're being installed on the current host, but that's not true when you're building packages into an image. The installer is being run on the host system but with the target set to a disk image. There are several things that a package will need to observe to install successfully:
• No user is logged in
Packages that rely on a user launching the install will fail. This includes payloads that install into user's home directories, and scripts that make assumptions about $HOME or $USER.
• The host OS is not the same as the target OS
The host may be running one build of OS X while installing another.
• The installation target is not the system root
If the package has preinstall or postinstall scripts, they need to reference paths on the installation by prefixing them with "$3".
• Installation scripts run on the host
The preinstall and postinstall scripts run on the host OS during image building. Commands such as networksetup and scutil will interact with the host, not the image.
Recommendations
Less is more
Only include the packages you absolutely need in the image. Install everything else after the system has booted.
Avoid scripts
The only safe packages are those that only include a payload and no scripts.