How to make a modified dmg distributable? Adding files to a dmg and redistribute it

Purpose :

Adding some settings files to firefox.dmg (mozilla.cfg and policies.json) in the objective of redistributing the modified dmg 

How the dmg is modified :


Decompressing the dmg with tools like (hdiutils/ultraiso/transmac/dropdmg/disk-utilities)
Mounting and adding files to the decompressed dmg
Optional (recompress the dmg with same utils used to decompress) 


Issue :

Opening the new dmg in a different machine give the result "firefox" is damaged and can't be opened, you should move it to trash 

What was tested :


Removing com.apple.quarantine attribute with the command xattr -c works but its not a reliable solution
Tried to remove _CodeSignature directories from the dmg without success
Creating a new dmg containing files of the previous one without success
Tried to edit Info.plist without success


Question :

How to make the new dmg package usable in other machines ? (How to avoid the error from gatekeeper without using xattr -c)
You cannot modify the DMG and have it still pass trough GateKeeper without re-signing it. This is basically the entire reason for having the code signature!

Basically you have three options:

1) Remove the old code signature and re-sign the DMG with your own signature. This requires you to be enrolled in Apple's Developer Program.

2) Distribute the original, unmodified DMG - and accompany it with your own modifications. This could be done as instructions for the user on what to copy over, or it could be in the form of an automatic script.

3) Remove the signatures completely (both from the DMG and the app). The user then needs to have GateKeeper set to allow opening unsigned applications (i.e. the user will be prompted on the first open).