Avast for business DMG repack?

WBS
New Contributor III

Hello Im trying to deploy avast through caspersuite to our macs when we image them and what not and its not working correctly. I was wondering how you guys do something like that? I talked to avast support and they said to use a repackaged installer, I am fairly new to mac so unsure on how to do that. is there a tool to use to do such a thing?

I use the DMG from the avast for business portal and its set up with correct info however using composer it doesnt like to work correctly.

18 REPLIES 18

andrew_nicholas
Valued Contributor

What's included in the DMG? If it's like the free version, than it just to appears to be a custom pkg file than can be drag and dropped into Admin.

WBS
New Contributor III

Thats what I tried to do and doing that then puts the installer on the image but then i have to install it, im trying to have it silent install at some point in the image.

andrew_nicholas
Valued Contributor

Did you drag the DMG file or the PKG file contained within the DMG?

WBS
New Contributor III

I got the PKG within the DMG and it just adds the installer on the image.

andrew_nicholas
Valued Contributor

Where does it place the installer on the image?

WBS
New Contributor III

when you go to computer it just had it as a pkg file just like when you open the dmg

WBS
New Contributor III

Im going to download a fresh copy of the dmg and throw the pkg file in admin and see what it does when i image.

WBS
New Contributor III

So i got a new copy and tried with the DMG and the PKG that was in the dmg neither worked as i wanted.Any ideas?

JamesHarwood
New Contributor

Any progress? I can add, the DMG has a config.tar file the package reaches out too.

WBS
New Contributor III

It seems the newer version that i downloaded and used worked fine with using composer. It has been for a few months now. After the computers image it pops up and says expired then i force a download of the update and it syncs up as normal then its fine from there.

agerson
New Contributor III

If you contact their support they will make a custom installer for you that is deployable with Casper.

wylan_swets
New Contributor II

If anyone is still trying to do get an easier way to install Avast Business through Jamf, I wrote a script to install it as silently as possible using the DMG you download from their admin portal. No re-packing necessary, just the DMG and the script.

Let me know if anyone is interested and I'll post it up.

dgrisale
New Contributor

hey @wylan.swets please post that script. Im also have a hard time trying to install avast silently on our macs.

Thanks in advance!

  • Diego

wylan_swets
New Contributor II

Here it is. Here are the main things to be aware of:

  • You will need to put the DMG that avast provides on the root of the main disk. I do this by packaging the dmg through composer on the root of your main disk. You'll see the last line of the script is referencing it as "/avast.dmg" so it is important you either place it there with that exact name, or adjust the script accordingly.

  • We use Avast Business, so after "avast.dmg" is mounted, it's friendly name path is used on the line that starts with "/usr/sbin/installer". If your Avast installer is different, this may be different. The easiest way to resolve this is by mounting your avast dmg on the desktop and dragging the .pkg on the script to replace the path starting after -pkg on that line (e.g. /Volumes/YourPathHere/AvastInstallerName.pkg)

  • The second to last line might also need to be adjusted if you're needing to adjust the package path at all.

After your script will play nice with the exact paths and all... put in a policy in Jamf that will run the package (to put the dmg on the root of the disk) and then executes this script after the package has been run.

Lastly... please do feel free to ask any questions. I know it might be a bit rough but you are also able to test this script on a machine before running it in jamf to be sure the paths do work. I recommend this whole heartedly before bothering to use Jamf to test.

#!/bin/bash

# the dmg has been copied down through a package and should be on the disk in this location
/usr/bin/hdiutil attach /avast.dmg -nobrowse

# Install the avast.pkg from inside the avast dmg so it works properly
/usr/sbin/installer -pkg /Volumes/Avast Business Antivirus/Avast Business Antivirus.pkg -target /

# Wait for a few seconds to make sure the app opens before trying to kill it
sleep 5

# quit the desktop app so the user doesn't have to interact with it
osascript -e 'quit app "Avast"'

# detach the avast dmg
/usr/bin/hdiutil detach /Volumes/Avast Business Antivirus/

# cleanup by removing the avast.dmg from the disk
rm /avast.dmg

roeyb
New Contributor

Great explanation @wylan.swets which I successfully used to create a policy that deploys Avast Business to our users. Unfortunately, starting with Catalina, "you can no longer store files or data in the read-only system volume, nor can you write to the root.... For the purposes of this script, I was able to use the /Users/Shared folder instead of / as a destination for the dmg file (i.e. use /Users/Shared/avast.dmg instead of /avast.dmg in Composer and in the bash script). I wonder if there is a more secure place on the main disk where the dmg file can be placed, because /Users/Shared in wide open to all users, by design.

wylan_swets
New Contributor II

@roeyb Great!
Yes... so you are correct and I updated my script as well to accommodate Catalina. My newest workflow is to take the unaltered DMG from avast and simply rename it to "avast.dmg" (much easier than packaging it) and upload that to Jamf. Then when installing Avast, I tell Jamf in the policy to "Cache" the avast DMG file and NOT install it. That will place the avast.dmg file in the Jamf waiting room which is generally more secured from users as, if I'm remembering correctly, requires root to access or alter. In that same policy that "caches" the avast.dmg file, I run the attached script. The script generally will do the same thing but now notice it also cleans up the associated dmg and .xml file that Jamf uses to determine if a package is cached. At the end of the policy I force an inventory update which tells Jamf that avast is now installed, and I believe also helps in cleaning up that the package has been cached but I don't recall if an inventory update is pertinent to that or not.

TL;DR bullet list:
1. Rename vanilla Avast dmg file to just "avast.dmg" and upload to Jamf
2. Make jamf policy:
- Cache avast.dmg
- Run attached script set to "After"
- Update inventory (Under maintenance in the policy)

#!/bin/bash

# the dmg has been cached and should be on the disk in this location
/usr/bin/hdiutil attach /Library/Application Support/JAMF/Waiting Room/avast.dmg -nobrowse

# Install the avast.pkg from inside the avast dmg so it works properly
/usr/sbin/installer -pkg /Volumes/Avast Business Antivirus/Avast Business Antivirus.pkg -target /

# Wait for a few seconds to make sure the app opens before trying to kill it
sleep 5

# quit the desktop app so the user doesn't have to interact with it
osascript -e 'quit app "Avast"'

# detach the avast dmg
/usr/bin/hdiutil detach /Volumes/Avast Business Antivirus/

# cleanup by removing the avast.dmg from the disk
rm /Library/Application Support/JAMF/Waiting Room/avast.dmg
rm /Library/Application Support/JAMF/Waiting Room/avast.dmg.cache.xml

greend
New Contributor

I have tried following your guidelines. I don't know what I am doing wrong but it seems that the script fails because the path is wrong. Here is the output: Script result: expected CRC32 $9E26F49A
/dev/disk1 GUID_partition_scheme /dev/disk1s1 Apple_HFS /Volumes/Avast Business Antivirus
installer: Error the package path specified was invalid: '/Volumes/Avast Business Antivirus/Avast Business Antivirus.pkg'.
2020-05-29 10:14:53.025 osascript[3879:56330] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2020-05-29 10:14:53.026 osascript[3879:56330] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2020-05-29 10:14:53.027 osascript[3879:56330] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
2020-05-29 10:14:53.027 osascript[3879:56330] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
0:16: execution error: Avast got an error: User canceled. (-128)
"disk1" unmounted.
"disk1" ejected.

We use the managed version of Avast.
Can you give me some insight?

wylan_swets
New Contributor II

So 2 things to check.
1) I have only used the "full offline installer". So when you download the installer from your dashboard make sure you use the advanced options to select what you want (this also lets you drop the Macs in to the appropriate avast group by default which is super neat).

2) I just downloaded the latest installer from my business dashboard and the name of the PKG file has changed. It used to be just "Avast Business Antivirus.pkg" and now it is "Install Avast Business Antivirus.pkg".

Everything else looks the same, but I will be testing the newest installer later on as I am still installing the older looking version which then needs to be updated to the newer one on the Mac. Let me know if that makes a difference for you, otherwise as I said I'll test this against the newest version later on.