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

@@ -1,9 +1,18 @@
#!/bin/bash
# Updating Installomator
# Usefull to push out after deployment if earlier version was deployed in DEP profile
# Currently script uses valuesfromarguments as a label is not included before next release, so this can be used to install to version 0.7
what="installomator" # enter the software to install
LOGO="appstore" # or "addigy", "microsoft", "mosyleb", "mosylem"
# 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 &
@@ -14,30 +23,19 @@ 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
# Install software using Installomator
cmdOutput="$(${destFile} ${what} LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore NOTIFY=silent LOGGING=req || true)"
${destFile} valuesfromarguments\
name=Installomator \
type=pkg \
packageID=com.scriptingosx.Installomator \
downloadURL=https://github.com/Installomator/Installomator/releases/download/v0.7release/Installomator-0.7.0.pkg \
appNewVersion=0.7 \
expectedTeamID=JME5BW3F3R \
BLOCKING_PROCESS_ACTION=ignore \
NOTIFY=silent
# ${destFile} ${what} BLOCKING_PROCESS_ACTION=ignore NOTIFY=silent
if [ $? != 0 ]; then
# This is currently not working in Mosyle, that will ignore script errors. Please request support for this from Mosyle!
echo "Error installing ${what}. Exit code $?"
caffexit $?
# 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} -eq 0 ]] ; then
echo -e "${what} succesfully installed.\n"
else
echo -e "Error installing ${what}. Exit code ${exitStatus}\n"
#echo "$cmdOutput"
errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
echo "$errorOutput"
caffexit $exitStatus
fi
echo "[$(DATE)][LOG-END]"