Installation fails when postinstall in mpkg installs a pkg

I have an installation workflow that works by a user double clicking on the mpkg and going through the prompts to install some software. Within the postinstall of the mpkg, /usr/sbin/installer -pkg "path_to_pkg" -target / is done to install additional software.

The software contained in the mpkg contains system extensions and installs without issue.

The software contained in the pkg file also contains system extensions and a prompt with this message displayed.

"XSoftware" is damaged and can't be opened. You should move it to the Trash
This file was downloaded on an unknown date.

This is causing issues with the system extension being installed from XSoftware.

Curiously enough, when I run /usr/sbin/installer -pkg "path_to_pkg" -target / manually in a terminal window it works successfully and XSoftware is able to install the System Extensions and run properly.

I've used the pkgutil --check-signature to check the notarization and signing and it looks correct.

This is my dmg structure:

dmg
  |
  mpkg
  data_folder
    |
    pkg

Any suggestions or help would be greatly appreciated. I can provide more details if neccessary.

Installation fails when postinstall in mpkg installs a pkg
 
 
Q