Embedding an installation code for .PKG being deployed

moiz_qureshi
New Contributor

When installing a software using terminal, I use this command:

sudo sh ~/Desktop/cbdefense_install_unattended.sh -i "/Users/name/Desktop/CbDefense |
Install.pkg" -c COMPANY CODE

Company code being the access code. It installs perfectly, silent, and the software communicates with the agent.

Now, since it successfully installs I used the Snapshot tool from Casper Composer. Took snap shots before and after installation. It then compiled the changes into a .pkg.

I can install the .PKG to a target device using terminal or remote command and it works but does not communicate with the agent.

Since Snapshotting is not working, I need to know how I can repackage the .pkg with the company code within it, so when it is deployed using Casper it can work on all targeted devices.

Details would be greatly appreciated.

2 ACCEPTED SOLUTIONS

blackholemac
Valued Contributor III

Second @sdagley ...that's one way to do it...what I do is build a wrapper package that dumps the actual pkg and as a postinstall script, use the command line installer with any special switches. When testing that, try installing your pkg from command line manually (make music comes to mind in the past) some vendors are very sloppy with their packages. I would also try pushing your wrapper to a small test bed before mass deployment. A well built package should install just fine while both being logged in or being at the login window.

View solution in original post

mpermann
Valued Contributor II

@moiz.qureshi You really shouldn't need the separate install.sh script. In Composer, if you click the disclosure triangle (see attached screen shot)7600eae9c45d4e218682983e7f6d461a to show the scripts portion under your package you can add a post install script and put the sudo sh /private/tmp/Confer/cbdefense_install_unattended.sh -i "/private/tmp/Confer/CbDefense Install.pkg" in the post install script. Save your changes and then rebuild the pkg file and you should be good to give it a try.

View solution in original post

8 REPLIES 8

sdagley
Esteemed Contributor II

@moiz.qureshi Use Composer to create a .dmg that will drop your installer somewhere in /tmp then deploy that with a Policy that executes the install using your COMPANY_CODE

Nix4Life
Valued Contributor

@moiz.qureshi have you tried the .pkg with a post-install script? you could then clean up after the install

blackholemac
Valued Contributor III

Second @sdagley ...that's one way to do it...what I do is build a wrapper package that dumps the actual pkg and as a postinstall script, use the command line installer with any special switches. When testing that, try installing your pkg from command line manually (make music comes to mind in the past) some vendors are very sloppy with their packages. I would also try pushing your wrapper to a small test bed before mass deployment. A well built package should install just fine while both being logged in or being at the login window.

moiz_qureshi
New Contributor

Thanks for the responses everyone @sdagley @LSinNY @blackholemac .

So far this is what I came up with.

I created a folder called Confer in the "/private/tmp " . Within the folder I dragged the following:

1) original .pkg for Confer

2) cbdefense_install_unattended.sh - This came along with Confer and I hardcoded the access code within it

3) install.sh - I created this file and put this code in it:

#!/bin/sh
#!/bin/bash

sudo sh /private/tmp/Confer/cbdefense_install_unattended.sh -i "/private/tmp/Confer/CbDefense Install.pkg"

exit 0

I dragged this folder in Composer and built a .pkg.

Now I will create a policy with this execute command: "/Confer/install.sh"

I do not have write access to Casper yet, but I am waiting to test this. I believe it will work.

moiz_qureshi
New Contributor

delete

mpermann
Valued Contributor II

@moiz.qureshi You really shouldn't need the separate install.sh script. In Composer, if you click the disclosure triangle (see attached screen shot)7600eae9c45d4e218682983e7f6d461a to show the scripts portion under your package you can add a post install script and put the sudo sh /private/tmp/Confer/cbdefense_install_unattended.sh -i "/private/tmp/Confer/CbDefense Install.pkg" in the post install script. Save your changes and then rebuild the pkg file and you should be good to give it a try.

moiz_qureshi
New Contributor

Sweet! All methods work, but I ended up doing what you done @mpermann . Thanks all!

donmontalvo
Esteemed Contributor III

Might want to make the source folder invisible, you know, to keep those kids off your lawn...

/private/tmp/.Confer/CbDefense Install.pkg

--
https://donmontalvo.com