MDM scripts updated

This commit is contained in:
Søren Theilgaard
2022-03-30 13:39:23 +02:00
parent 7fa9d3c24a
commit f8a3104470
6 changed files with 167 additions and 102 deletions

View File

@@ -5,8 +5,28 @@ what="brave" # enter the software to install
# To be used as a script sent out from a MDM.
# Fill the variable "what" above with a label.
# Script will run this label.
LOGO="appstore" # or "addigy", "microsoft", "mosyleb", "mosylem"
######################################################################
# Parameters for reinstall/initial install (owner root:wheel):
# "BLOCKING_PROCESS_ACTION=quit_kill INSTALL=force IGNORE_APP_STORE_APPS=yes SYSTEMOWNER=1"
# Parameters for Self Service installed app:
# "BLOCKING_PROCESS_ACTION=prompt_user NOTIFY=all"
# Parameters for security important apps, like browsers (run automaticaly every day):
# "BLOCKING_PROCESS_ACTION=tell_user_then_kill"
# Update of service apps (run automatically):
# "BLOCKING_PROCESS_ACTION=quit_kill NOTIFY=silent"
parameters="BLOCKING_PROCESS_ACTION=tell_user_then_kill NOTIFY=all"
###############################################
# Verify that Installomator has been installed
destFile="/usr/local/Installomator/Installomator.sh"
if [ ! -e "${destFile}" ]; then
echo "Installomator not found here:"
echo "${destFile}"
echo "Exiting."
exit 99
fi
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
@@ -16,18 +36,14 @@ caffexit () {
exit $1
}
# Verify that Installomator has been installed
destFile="/usr/local/Installomator/Installomator.sh"
if [ ! -e "${destFile}" ]; then
echo "Installomator not found here:"
echo "${destFile}"
echo "Exiting."
caffexit 99
fi
${destFile} ${what} LOGO=mosyleb BLOCKING_PROCESS_ACTION=tell_user #NOTIFY=all #INSTALL=force
if [ $? != 0 ]; then
# This is currently not working in Mosyle, that will ignore script errors. Please request support for this from Mosyle!
cmdOutput="$(${destFile} ${what} LOGO=$LOGO $parameters LOGGING=WARN || true)"
# Check result
exitStatus="$( echo "${cmdOutput}" | grep --binary-files=text -i "exit" | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' || true )"
if [[ ${exitStatus} -ne 0 ]] ; then
echo -e "Error installing ${what}. Exit code ${exitStatus}"
#echo "$cmdOutput"
errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
echo "$errorOutput"
echo "Error installing ${what}. Exit code $?"
caffexit $?
fi