Shell script with "-i" as input parameter

Bernard_Huang
Contributor III

Hi,

I've search through discussion and haven't found any similar question yet.

I've been given a shell script install.sh, which runs a McAfee EPM install. In order to run it, it needs either
install.sh -i (i for install)
install.sh -u (u for uninstall)

I have uploaded this script onto Casper JSS scripts, but I'm getting a fail. Should I be putting "-i" in parameter 4 of the script policy? (I tried, it didn't work)

4 REPLIES 4

Sonic84
Contributor III

You may have better luck if you put this script in a PKG via Casper Composer. McAfee's installer.sh script as-is can be a pain.

Install the script into a temp folder, then have a postinstall script in the PKG that runs the install command with the flag you need. I use method for my McAfee package. I also have it do an uninstall of previous known versions before it loads the new ePO agent so I can always use -i. I've found -u is unreliable... At least in my environment.

donmontalvo
Esteemed Contributor III

The McAfee ePO Agent is probably the worst case of "We don't care how bad it is, they keep buying it, so we ain't changing a thing" development in the business.

That team should be fired, and the work handed off to the team responsible for the well designed, signed and flat PKG installer for the McAfee EPM Client.

You'll need to wrap install.sh and put it somewhere like /tmp, then use a postinstallation script to invoke the install. Check out the attached screenshots.

3afd99d3f83a4f6b87d36ff333dc88a1
d9d52f8406134e1599351a6619c8e01d

--
https://donmontalvo.com

AVmcclint
Honored Contributor

I use the script found here https://github.com/franton/McAfee-Agent and it works great. It checks for the existence of McAfee folders. If the folders already exist, it uses the -u switch. If the folders don't already exist, it uses the -i switch. This is great for when you have various computers in different states of install/upgrade.

Look
Valued Contributor III

-i needs to be $1 casper already uses this and moves the first parameter to $4
If you want to use it directly you will need to look inside the script and find where is checking the -i (probably has and if or else statement containg $1 and change it to reference $4 instead.
There may be multiple references so it could get complex.
But yeah as suggested, just deliver it to the machine in a .DMG and call it from another script or command line option in a policy.