Merge pull request #328 from Installomator/MDM-script-with-caffeine

MDM with caffeinate
This commit is contained in:
Søren Theilgaard
2021-11-22 10:59:49 +01:00
committed by GitHub
7 changed files with 72 additions and 23 deletions

View File

@@ -3,6 +3,7 @@
- Installomator now detects when an app is already installed, and will display notifications correctly the user based on if the app was updated or installed for the first time. - Installomator now detects when an app is already installed, and will display notifications correctly the user based on if the app was updated or installed for the first time.
- New variables for labels that should be installaed using CLI: `CLIInstaller` and `CLIArguments`. If the installer app is named differently than the installed app, then the variable `installerTool` should be use to name the app that should be located in the DMG or zip. See the label __adobecreativeclouddesktop__ to see its use. - New variables for labels that should be installaed using CLI: `CLIInstaller` and `CLIArguments`. If the installer app is named differently than the installed app, then the variable `installerTool` should be use to name the app that should be located in the DMG or zip. See the label __adobecreativeclouddesktop__ to see its use.
- `buildLabel.sh` has been improved to build GitHub software labels much easier. In essense if the URL contains github.com, then it will try to find if it's the latest version or if variable `archiveName` is needed for finding the software. Also improved messaging throughout the script, as well as handling a situation where a pkg does not include a “DIstribution” file, but a “PackageInfo”. - `buildLabel.sh` has been improved to build GitHub software labels much easier. In essense if the URL contains github.com, then it will try to find if it's the latest version or if variable `archiveName` is needed for finding the software. Also improved messaging throughout the script, as well as handling a situation where a pkg does not include a “DIstribution” file, but a “PackageInfo”.
- MDM script extended with `caffeinate` so Mac will not go to sleep during the time it takes installomator to run. Especially during setup, this can be handy.
- Microsoft labels with `updateTool` variable, is updated to run `msupdate --list` before running the updateTool directly. Problems have been reported that the update would fail if the `--list` parameter for the command was not run first. - Microsoft labels with `updateTool` variable, is updated to run `msupdate --list` before running the updateTool directly. Problems have been reported that the update would fail if the `--list` parameter for the command was not run first.
## v0.7 ## v0.7

View File

@@ -7,6 +7,13 @@ what="brave" # enter the software to install
# Script will run this label. # Script will run this label.
############################################### ###############################################
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid"
exit $1
}
# Verify that Installomator has been installed # Verify that Installomator has been installed
destFile="/usr/local/Installomator/Installomator.sh" destFile="/usr/local/Installomator/Installomator.sh"
@@ -14,19 +21,19 @@ if [ ! -e "${destFile}" ]; then
echo "Installomator not found here:" echo "Installomator not found here:"
echo "${destFile}" echo "${destFile}"
echo "Exiting." echo "Exiting."
exit 99 caffexit 99
fi fi
${destFile} ${what} LOGO=mosyleb BLOCKING_PROCESS_ACTION=tell_user #NOTIFY=all #INSTALL=force ${destFile} ${what} LOGO=mosyleb BLOCKING_PROCESS_ACTION=tell_user #NOTIFY=all #INSTALL=force
if [ $? != 0 ]; then if [ $? != 0 ]; then
# This is currently not working in Mosyle, that will ignore script errors. Please request support for this from Mosyle! # 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 $?" echo "Error installing ${what}. Exit code $?"
exit $? caffexit $?
fi fi
echo "[$(DATE)][LOG-END]" echo "[$(DATE)][LOG-END]"
exit 0 caffexit 0
# notify behavior # notify behavior
# NOTIFY=success # NOTIFY=success

View File

@@ -7,13 +7,24 @@ what="microsoftteams microsoftyammer firefox bravebrowser cyberduck vlc signal"
# Script will loop through these labels. # Script will loop through these labels.
###################################################################### ######################################################################
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid"
exit $1
}
# Count errors
errorCount=0
# Verify that Installomator has been installed # Verify that Installomator has been installed
destFile="/usr/local/Installomator/Installomator.sh" destFile="/usr/local/Installomator/Installomator.sh"
if [ ! -e "${destFile}" ]; then if [ ! -e "${destFile}" ]; then
echo "Installomator not found here:" echo "Installomator not found here:"
echo "${destFile}" echo "${destFile}"
echo "Exiting." echo "Exiting."
exit 99 caffexit 99
fi fi
for item in $what; do for item in $what; do
@@ -22,13 +33,15 @@ for item in $what; do
if [ $? != 0 ]; then if [ $? != 0 ]; then
# This is currently not working in Mosyle, that will ignore script errors. Please request support for this from Mosyle! # This is currently not working in Mosyle, that will ignore script errors. Please request support for this from Mosyle!
echo "[$(DATE)] Error installing ${item}. Exit code $?" echo "[$(DATE)] Error installing ${item}. Exit code $?"
# exit $? let errorCount++
fi fi
done done
echo
echo "Errors: $errorCount"
echo "[$(DATE)][LOG-END]" echo "[$(DATE)][LOG-END]"
exit 0 caffexit $errorCount
# notify behavior # notify behavior
# NOTIFY=success # NOTIFY=success

View File

@@ -5,13 +5,21 @@
what="installomator" # enter the software to install what="installomator" # enter the software to install
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid"
exit $1
}
# Verify that Installomator has been installed # Verify that Installomator has been installed
destFile="/usr/local/Installomator/Installomator.sh" destFile="/usr/local/Installomator/Installomator.sh"
if [ ! -e "${destFile}" ]; then if [ ! -e "${destFile}" ]; then
echo "Installomator not found here:" echo "Installomator not found here:"
echo "${destFile}" echo "${destFile}"
echo "Exiting." echo "Exiting."
exit 99 caffexit 99
fi fi
${destFile} valuesfromarguments\ ${destFile} valuesfromarguments\
@@ -28,9 +36,8 @@ ${destFile} valuesfromarguments\
if [ $? != 0 ]; then if [ $? != 0 ]; then
# This is currently not working in Mosyle, that will ignore script errors. Please request support for this from Mosyle! # 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 $?" echo "Error installing ${what}. Exit code $?"
exit $? caffexit $?
fi fi
echo "[$(DATE)][LOG-END]" echo "[$(DATE)][LOG-END]"
caffexit 0
exit 0

View File

@@ -15,6 +15,14 @@ what="supportapp xink textmate microsoftedge wwdc keka vlc " # enter the softwar
# Script will loop through these labels and exit with number of errors. # Script will loop through these labels and exit with number of errors.
###################################################################### ######################################################################
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid"
exit $1
}
# Count errors # Count errors
errorCount=0 errorCount=0
@@ -24,7 +32,7 @@ if [ ! -e "${destFile}" ]; then
echo "Installomator not found here:" echo "Installomator not found here:"
echo "${destFile}" echo "${destFile}"
echo "Exiting." echo "Exiting."
exit 99 caffexit 99
fi fi
for item in $what; do for item in $what; do
@@ -34,7 +42,6 @@ for item in $what; do
# Error handling # Error handling
echo "[$(DATE)] Error installing ${item}. Exit code $?" echo "[$(DATE)] Error installing ${item}. Exit code $?"
let errorCount++ let errorCount++
# exit $?
fi fi
done done
@@ -42,7 +49,7 @@ echo
echo "Errors: $errorCount" echo "Errors: $errorCount"
echo "[$(DATE)][LOG-END]" echo "[$(DATE)][LOG-END]"
exit $errorCount caffexit $errorCount
# Mark: Conditions # Mark: Conditions
# Install on success # Install on success

View File

@@ -7,7 +7,15 @@ what="handbrake theunarchiver microsoftoffice365"
# Covered by Mosyle Catalog: "brave firefox googlechrome microsoftedge microsoftteams signal sublimetext vlc webex zoom" among others # Covered by Mosyle Catalog: "brave firefox googlechrome microsoftedge microsoftteams signal sublimetext vlc webex zoom" among others
###################################################################### ######################################################################
## Code here ## Mark: Code here
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid"
exit $1
}
# Mark: Condition for Installomator installation # Mark: Condition for Installomator installation
@@ -19,12 +27,12 @@ if [[ "$TARGET_VERSION" != "$INSTALLED_VERSION" ]]; then
TMPDIR=$(mktemp -d ) TMPDIR=$(mktemp -d )
if ! cd "$TMPDIR"; then if ! cd "$TMPDIR"; then
echo "error changing directory $TMPDIR" echo "error changing directory $TMPDIR"
exit 98 caffexit 98
fi fi
NAME=$TMPDIR/$(date +%s).pkg NAME=$TMPDIR/$(date +%s).pkg
if ! curl -fsL "$URLDOWNLOAD" -o "$NAME"; then if ! curl -fsL "$URLDOWNLOAD" -o "$NAME"; then
echo "error downloading $URLDOWNLOAD to $NAME." echo "error downloading $URLDOWNLOAD to $NAME."
exit 97 caffexit 97
fi fi
installer -pkg "$NAME" -target / installer -pkg "$NAME" -target /
rm -rf "$TMPDIR" rm -rf "$TMPDIR"
@@ -44,7 +52,7 @@ if [ ! -e "${destFile}" ]; then
echo "Installomator not found here:" echo "Installomator not found here:"
echo "${destFile}" echo "${destFile}"
echo "Exiting." echo "Exiting."
exit 99 caffexit 99
fi fi
for item in $what; do for item in $what; do
@@ -54,7 +62,6 @@ for item in $what; do
# Error handling # Error handling
echo "[$(DATE)] Error installing ${item}. Exit code $?" echo "[$(DATE)] Error installing ${item}. Exit code $?"
let errorCount++ let errorCount++
# exit $?
fi fi
done done
@@ -62,4 +69,4 @@ echo
echo "Errors: $errorCount" echo "Errors: $errorCount"
echo "[$(DATE)][LOG-END]" echo "[$(DATE)][LOG-END]"
exit $errorCount caffexit $errorCount

View File

@@ -4,13 +4,21 @@
what="valuesfromarguments" # enter the software to install what="valuesfromarguments" # enter the software to install
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid"
exit $1
}
# Verify that Installomator has been installed # Verify that Installomator has been installed
destFile="/usr/local/Installomator/Installomator.sh" destFile="/usr/local/Installomator/Installomator.sh"
if [ ! -e "${destFile}" ]; then if [ ! -e "${destFile}" ]; then
echo "Installomator not found here:" echo "Installomator not found here:"
echo "${destFile}" echo "${destFile}"
echo "Exiting." echo "Exiting."
exit 99 caffexit 99
fi fi
${destFile} valuesfromarguments \ ${destFile} valuesfromarguments \
@@ -26,9 +34,8 @@ ${destFile} valuesfromarguments \
if [ $? != 0 ]; then if [ $? != 0 ]; then
# This is currently not working in Mosyle, that will ignore script errors. Please request support for this from Mosyle! # 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 $?" echo "Error installing ${what}. Exit code $?"
exit $? caffexit $?
fi fi
echo "[$(DATE)][LOG-END]" echo "[$(DATE)][LOG-END]"
caffexit 0
exit 0