I am in the process of setting up an MDM system (Mosyle) to manage our fleet of Mac's. As part of the set up, we are loading apps to deploy to the fleet of Mac's via the MDM.
Sophos Endpoint is what this thread is regarding, I have found instructions for how to deploy this via JAMF Pro, however we are using Mosyle so I have had to loosely follow these instructions but regardless following the same principles -
Following this guide, I have managed make the app deployable. This is tested and does work - Happy days! Essentially it runs through a script, that utilizes curl to pull the application from Sophos repository to the local machine and install accordingly. However I would like to further adapt this....
What I am ideally after is for this script top run periodically, say once a day and to essentially do the following:
- Scan the /Applications folder to verify if Sophos Endpoint is installed on the machine, if so - EXIT, if not installed - Proceed with remaining script.
- Download and Install Sophos.
Below is the current script in its entirety (all besides the curl URL for confidentiality purposes) this script does stage 2 of the above, so essentially what i am looking for is some script before the Download / Install lines to check for any pre-existing installs...
#!/bin/bash
SOPHOS_DIR="/Users/Shared/Sophos_Install"
mkdir $SOPHOS_DIR
cd $SOPHOS_DIR
# Installing Sophos
curl -L -O "https://api-cloudstation-us-east-2.prod.hydra.sophos.com/api/download/localinstall/SophosInstall.zip"
unzip SophosInstall.zip
chmod a+x $SOPHOS_DIR/Sophos\ Installer.app/Contents/MacOS/Sophos\ Installer
chmod a+x $SOPHOS_DIR/Sophos\ Installer.app/Contents/MacOS/tools/com.sophos.bootstrap.helper
sudo $SOPHOS_DIR/Sophos\ Installer.app/Contents/MacOS/Sophos\ Installer --quiet
rm -rf $SOPHOS_DIR
exit 0
I am very new to the bash scripting world, I have had a little browse but havent been too successful in making anything quite work for this and was wondering if anybody had any further input?
If there is any further info I can provide to help make this a bit clearer please do let me know :)
Thank you for taking the time to read this! Happy Friday! Mike
As per main body, I have managed to make the app deployable but struggling to place some script in front of it to determine if the software is already installed, and if so to not proceed with the download / install of Sophos.