Help with action script to install MAC pkg

Hey everyone,

Trying to install a mac pkg file which succsesfully downloads to the \tmp\ folder on the mac. I can browse it via terminal and I see the pkg file there.

The command completes with exit code -1 and the application is not installed.

Here’s the action script i am using, again the pkg file is delivered to \tmp just cant get the installer to work.

// prefetch downloads a besarchive of the image and checks its sha values
prefetch 893f8204d57e6f38de82b19f33c4b81c75f0c5ac sha1:893f8204d57e6f38de82b19f33c4b81c75f0c5ac size:67287847 http://127.0.0.1:52311/Uploads/893f8204d57e6f38de82b19f33c4b81c75f0c5ac/PrinterInstallerClientSetup.pkg.bfswd sha256:9290bb2a7448bbeebcee902ff4dd0fb0993924f940ef1a6c88b0949ea18a2f37

//deletes PrinterInstallerClientSetup.pkg if already exists
delete “/tmp/PrinterInstallerClientSetup.pkg”

//creates the /tmp folder
folder create /tmp

// copies the file from download to the temp folder
copy “__Download/893f8204d57e6f38de82b19f33c4b81c75f0c5ac” “/tmp/PrinterInstallerClientSetup.pkg”

wait installer -allow untrusted -pkg “/tmp/PrinterInstallerClientSetup.pkg” -target / && sudo /opt/PrinterInstallerClient/bin/set_home_url.sh http print.domain.local && sudo /opt/PrinterInstallerClient/bin/use_authorization_code.sh

// deletes PrinterInstallerClientSetup.pkg from tmp
delete “/tmp/PrinterInstallerClientSetup.pkg”

Thanks!

It appears that the prefetched file is a BigFix archive file and you’re renaming it to a pkg, which is not going to work with Installer.app. You have to extract the archive first to have a valid installer .pkg file.

1 Like

Hi @amelgares.

I have the bfswd extension since I was looking at other actions that include the extension, yet the pkg file in the upload\ folder does not contain that extension. I compared to some other actions for windows files and I have for example msi files without the bfwd but yet the script shows the filename.exe.bfswd and those actions work fine.

So not understanding why scripts have file.ext.bfswd but the files in the bfix upload\ folder just have file.ext.

Also would you know if the installer command is the correct syntax to run on a mac?

wait installer -allow untrusted -pkg “/tmp/PrinterInstallerClientSetup.pkg” -target / && sudo /opt/PrinterInstallerClient/bin/set_home_url.sh http print.domain.local && sudo /opt/PrinterInstallerClient/bin/use_authorization_code.sh

Thanks again

Ok so after doing some more reading on the forums and trying to put it all together in my head I decide to break down each line instead of using and then (&&)

wait sudo -i installer -allow untrusted -pkg “/tmp/PrinterInstallerClientSetup.pkg” -target /
wait sudo -i /opt/PrinterInstallerClient/bin/set_home_url.sh http print.domain.local
wait sudo -i /opt/PrinterInstallerClient/bin/use_authorization_code.sh 2w4j54d

That completed successfully but I’ll do visual confirmation tomorrow in the office.

1 Like