Posted on 02-11-2016 06:17 AM
Hi all, first time caller, long time listener and fan of the discussion boards.
I have a script that I want to mount the CapserShare volume, copy a folder to the tmp folder, execute the pkg file, then remove the copied folder, then unmounts the share. Here's what I've cobbled together thus far:
```
mkdir "/Volumes/CasperShare" ; mount_afp "afp://username:password@serveripaddress/CasperShare" "/Volumes/CasperShare"
cp -R /Volumes/CasperShare/Packages/AgentInstaller_Mac64 /tmp/
sudo installer -pkg /tmp/AgentInstaller_Mac64/AgentInstall.pkg -target /
rm -R /tmp/AgentInstaller_Mac64/
diskutil unmount /Volumes/CasperShare
fi``
The pkg file has to be ran via the terminal, in order for it to install correctly. The reason for the desire to get to and copy the folder is so I can easily move updated files into the "AgentInstaller_Mac64" folder, when our Info Sec team creates an updated package (which includes other files.
I was a long time Desktop jockey, and know Casper Remote and Recon pretty well, but now I'm a Mac Admin and I'm in the process of learning about all this, and loving it.
Any thoughts and insight are welcomed, and appreciated.
Many thanks!
Posted on 02-11-2016 06:45 AM
My typical method for handling this situation is to create in installer that installs all that crap in a directory in /tmp/installerDir/ then has a postinstall script to run the commercial installer. It's easy to build an installer in Composer to put everything in /tmp/randomDir/ then have a post install script with
/usr/sbin/installer -pkg /tmp/AgentInstaller_Mac64/AgentInstall.pkg -target /
This way, you have a distributable package. Oh, now that I wrote that postinstall script, I'm thinking your issue may be that you didn't put the full path to /usr/sbin/installer.
Edit: and if you get a new version of the installer from the vendor, you just drop it in composer to replace the one there, and build a new package.
Posted on 02-11-2016 07:20 AM
Could be wrong but I think the problem might be that they don't want to re-package the software and want to leave it to the security team to maintain on that network share. Otherwise I'd agree that you should probably look at re-packaging it as described by @thoule
Posted on 02-11-2016 07:24 AM
Just wanted to add a correction. You should only repackage it assuming it doesn't work as provided already by the vendor. It may very well work as is which it probably does considering you were installing it already via the installer command line.
Posted on 02-11-2016 11:10 AM
You're correct @bpavlov, I'd like to avoid repackaging, if possible. I forgot to mention that if I run these commands through ARD it all executes as expected. The idea of using Composer that @thoule suggested is a good one, and I'm more than likely going to consider it for other sorts of deployments.