Update zt-dialog.sh

This commit is contained in:
Michael
2022-09-20 18:18:16 +01:00
committed by GitHub
parent d45152f05f
commit 9221eb1739

View File

@@ -1,8 +1,58 @@
!/bin/bash
#
# List of apps to process
# Provide the display name as you prefer and the path to the app/file. ex: "Google Chrome,/Applications/Google Chrome.app"
# Tip: Check for something like print drivers using the pkg receipt, ex: "Konica-Minolta drivers,/var/db/receipts/jp.konicaminolta.print.package.C759.plist"
#### START SILENT DIALOG INSTALL OR UPDATE
######################################################################
# Installation using Installomator (enter the software to install separated with spaces in the "whatList"-variable)
whatList="dialog"
# Covered by Mosyle Catalog: "brave firefox googlechrome microsoftedge microsoftteams signal sublimetext vlc webex zoom" among others
LOGO="mosyleb" # or "mosylem"
######################################################################
## Mark: Code here
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Mark: Start Installomator label(s) installation
# Count errors
errorCount=0
# Verify that Installomator has been installed
destFile="/usr/local/Installomator/Installomator.sh"
if [ ! -e "${destFile}" ]; then
curl https://raw.githubusercontent.com/PurpleComputing/mdmscripts/main/Installomator.sh | bash
fi
for what in $whatList; do
#echo $item
# Install software using Installomator
cmdOutput="$(${destFile} ${what} LOGO=$LOGO NOTIFY=silent BLOCKING_PROCESS_ACTION=quit_kill || true)" # NOTIFY=silent BLOCKING_PROCESS_ACTION=quit_kill INSTALL=force
# 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 "Error installing ${what}. Exit code ${exitStatus}"
#echo "$cmdOutput"
errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
echo "$errorOutput"
let errorCount++
fi
done
echo
echo "Errors: $errorCount"
echo "[$(DATE)][LOG-END]"
caffexit $errorCount
#### END SILENT DIALOG INSTALL OR UPDATE
apps=(
"Joining,/tmp/ztnetjoined.log"
"Authorising,/tmp/ztnetauthed.log"