Adding non-bundle files to a macOS package

I’m trying to create a macOS package with pkgbuild / productbuild that includes some non-bundle files. I do not want to use the Packages.app because I need to insure the installer will work on all versions of the operating system in the future (including Big Sur on Apple Silicon) so I don't want to use any third-party apps.

The folder layout looks like this:

Code Block
Root
Applications
MySample.app
Library
LaunchAgents
com.company.startup.plist
usr
local
bin
MyStartupEx

When I use pkgbuild to build the package, it refuses to add the .plist and MyStartupEx files into the package because they are not bundles.

I have searched all of the documentation and examples that I can find and cannot find an answer as to how I can include non-bundle files. I have also tried using pkgutil --flatten and the resulting package is invalid for productbuild.

Does anyone have an example that will allow non-bundle files to be added to a package?

Thank you!
Adding non-bundle files to a macOS package
 
 
Q