To automate an installer contained in a .dmg file the .dmg file must first be mounted, which can be achieved by using macOS's open command line tool.
|If installing the application (at the desired path) requires special privileges ("administrator", "sudo", "elevated"), Squish should be started with respective privilege, too to avoid any problems.|
Here is an example that demonstrates mounting a .dmg file and starting the contained installer:
.pkg files are not executable, and they are handled by a system application called Installer.app. Hooking this application via Squish is not currently possible, so Squish can not be used to automate the installation of apps that are packaged in this way.