diff --git a/MDM/App script.sh b/MDM/App script.sh new file mode 100755 index 0000000..59926f0 --- /dev/null +++ b/MDM/App script.sh @@ -0,0 +1,161 @@ +#!/bin/zsh +# Installation using Installomator +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. +############################################### + + +# 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 + +${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! + echo "Error installing ${what}. Exit code $?" + exit $? +fi + +echo "[$(DATE)][LOG-END]" + +exit 0 + +# notify behavior +# NOTIFY=success +# options: +# - success notify the user on success +# - silent no notifications +# - all all notifications (great for Self Service installation) + + +# behavior when blocking processes are found +# BLOCKING_PROCESS_ACTION=tell_user +# options: +# - ignore continue even when blocking processes are found +# - quit app will be told to quit nicely, if running +# - quit_kill told to quit twice, then it will be killed +# Could be great for service apps, if they do not respawn +# - silent_fail exit script without prompt or installation +# - prompt_user show a user dialog for each blocking process found +# abort after three attempts to quit +# (only if user accepts to quit the apps, otherwise +# the update is cancelled). +# - prompt_user_then_kill +# show a user dialog for each blocking process found, +# attempt to quit two times, kill the process finally +# - prompt_user_loop +# Like prompt-user, but clicking "Not Now", will just wait an hour, +# and then it will ask again. +# WARNING! It might block the MDM agent on the machine, as +# the scripts gets stuct in waiting until the hour has passed, +# possibly blocking for other management actions in this time. +# - tell_user User will be showed a notification about the important update, +# but user is only allowed to quit and continue, and then we +# ask the app to quit. +# - tell_user_then_kill +# Show dialog 2 times, and if the quitting fails, the +# blocking processes will be killed. +# - kill kill process without prompting or giving the user a chance to save + + +# logo-icon used in dialog boxes if app is blocking +# LOGO=appstore +# options: +# - appstore Icon is Apple App Store (default) +# - jamf JAMF Pro +# - mosyleb Mosyle Business +# - mosylem Mosyle Manager (Education) +# - addigy Addigy +# path can also be set in the command call, and if file exists, it will be used. +# Like 'LOGO="/System/Applications/App\ Store.app/Contents/Resources/AppIcon.icns"' +# (spaces have to be escaped). + + +# App Store apps handling +# IGNORE_APP_STORE_APPS=no +# options: +# - no If installed app is from App Store (which include VPP installed apps) +# it will not be touched, no matter it's version (default) +# - yes Replace App Store (and VPP) version of app and handle future +# updates using Installomator, even if latest version. +# Shouldn’t give any problems for the user in most cases. +# Known bad example: Slack will loose all settings. + + +# install behavior +# INSTALL="" +# options: +# - When not set, software will only be installed +# if it is newer/different in version +# - force Install even if it’s the same version + + +# Re-opening of closed app +# REOPEN="yes" +# options: +# - yes App wil be reopened if it was closed +# - no App not reopened + + +######################## +# Often used labels: +######################## + +# firefox +# firefox_intl +# brave +# torbrowser +# googlechrome +# netnewswire + +# adobereaderdc +# textmate + +# cyberduck +# keka +# theunarchiver + +# vlc +# handbrake + +# inkscape + +# signal +# telegram +# whatsapp + +# hazel +# devonthink + +# teamviewerqs +# zoom + +# malwarebytes +# githubdesktop +# sublimetext +# textmate +# visualstudiocode + +# microsoftskypeforbusiness +# microsoftteams +# microsoftyammer +# microsoftedgeenterprisestable +# microsoftedgeconsumerstable +# microsoftsharepointplugin +# microsoftdefenderatp + +# googledrivefilestream + +# cdef +# desktoppr +# supportapp +# xink +# wwdc diff --git a/MDM/App-loop script.sh b/MDM/App-loop script.sh new file mode 100755 index 0000000..2732267 --- /dev/null +++ b/MDM/App-loop script.sh @@ -0,0 +1,163 @@ +#!/bin/zsh +# Installation using Installomator +what="microsoftteams microsoftyammer firefox bravebrowser cyberduck vlc signal" # enter the software to install separated with spaces + +# To be used as a script sent out from a MDM. +# Fill the variable "what" above with labels separated by space " ". +# Script will loop through these labels. +###################################################################### + +# 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 + +for item in $what; do + #echo $item + ${destFile} ${item} 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! + echo "[$(DATE)] Error installing ${item}. Exit code $?" + # exit $? + fi +done + +echo "[$(DATE)][LOG-END]" + +exit 0 + +# notify behavior +# NOTIFY=success +# options: +# - success notify the user on success +# - silent no notifications +# - all all notifications (great for Self Service installation) + + +# behavior when blocking processes are found +# BLOCKING_PROCESS_ACTION=tell_user +# options: +# - ignore continue even when blocking processes are found +# - quit app will be told to quit nicely, if running +# - quit_kill told to quit twice, then it will be killed +# Could be great for service apps, if they do not respawn +# - silent_fail exit script without prompt or installation +# - prompt_user show a user dialog for each blocking process found +# abort after three attempts to quit +# (only if user accepts to quit the apps, otherwise +# the update is cancelled). +# - prompt_user_then_kill +# show a user dialog for each blocking process found, +# attempt to quit two times, kill the process finally +# - prompt_user_loop +# Like prompt-user, but clicking "Not Now", will just wait an hour, +# and then it will ask again. +# WARNING! It might block the MDM agent on the machine, as +# the scripts gets stuct in waiting until the hour has passed, +# possibly blocking for other management actions in this time. +# - tell_user User will be showed a notification about the important update, +# but user is only allowed to quit and continue, and then we +# ask the app to quit. +# - tell_user_then_kill +# Show dialog 2 times, and if the quitting fails, the +# blocking processes will be killed. +# - kill kill process without prompting or giving the user a chance to save + + +# logo-icon used in dialog boxes if app is blocking +# LOGO=appstore +# options: +# - appstore Icon is Apple App Store (default) +# - jamf JAMF Pro +# - mosyleb Mosyle Business +# - mosylem Mosyle Manager (Education) +# - addigy Addigy +# path can also be set in the command call, and if file exists, it will be used. +# Like 'LOGO="/System/Applications/App\ Store.app/Contents/Resources/AppIcon.icns"' +# (spaces have to be escaped). + + +# App Store apps handling +# IGNORE_APP_STORE_APPS=no +# options: +# - no If installed app is from App Store (which include VPP installed apps) +# it will not be touched, no matter it's version (default) +# - yes Replace App Store (and VPP) version of app and handle future +# updates using Installomator, even if latest version. +# Shouldn’t give any problems for the user in most cases. +# Known bad example: Slack will loose all settings. + + +# install behavior +# INSTALL="" +# options: +# - When not set, software will only be installed +# if it is newer/different in version +# - force Install even if it’s the same version + + +# Re-opening of closed app +# REOPEN="yes" +# options: +# - yes App wil be reopened if it was closed +# - no App not reopened + + +######################## +# Often used labels: +######################## + +# firefox +# firefox_intl +# brave +# torbrowser +# googlechrome +# netnewswire + +# adobereaderdc +# textmate + +# cyberduck +# keka +# theunarchiver + +# vlc +# handbrake + +# inkscape + +# signal +# telegram +# whatsapp + +# hazel +# devonthink + +# teamviewerqs +# zoom + +# malwarebytes +# githubdesktop +# sublimetext +# textmate +# visualstudiocode + +# microsoftskypeforbusiness +# microsoftteams +# microsoftyammer +# microsoftedgeenterprisestable +# microsoftedgeconsumerstable +# microsoftsharepointplugin +# microsoftdefenderatp + +# googledrivefilestream + +# cdef +# desktoppr +# supportapp +# xink +# wwdc diff --git a/MDM/Installomator update.sh b/MDM/Installomator update.sh new file mode 100755 index 0000000..47bedd3 --- /dev/null +++ b/MDM/Installomator update.sh @@ -0,0 +1,36 @@ +#!/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 + +# 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 + +${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 $?" + exit $? +fi + +echo "[$(DATE)][LOG-END]" + +exit 0 diff --git a/MDM/MDMAddigy CustomSoftware.sh b/MDM/MDMAddigy CustomSoftware.sh new file mode 100755 index 0000000..3cb867c --- /dev/null +++ b/MDM/MDMAddigy CustomSoftware.sh @@ -0,0 +1,92 @@ +#!/bin/zsh + +# Specific settings in Addigy to configure Custom Software for installomator. +# Addigy has 3 parts to fill out for this, Installation script, Condition, and Removal steps (see RemoveInstallomator.sh). + +# Mark: Installation script +# Just click “Add” to autogenerate the installer script line by clicking the “Add”-button next to the Installer PKG, replace with first line below +/usr/sbin/installer -pkg "/Library/Addigy/ansible/packages/Installomator (0.7.0)/Installomator-0.7.0.pkg" -target / + +# Installation using Installomator +what="supportapp xink textmate microsoftedge wwdc keka vlc " # enter the software to installed separated with spaces + +# To be used as a script sent out from a MDM. +# Fill the variable "what" above with labels separated by space " ". +# Script will loop through these labels and exit with number of errors. +###################################################################### + +# Count errors +errorCount=0 + +# 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 + +for item in $what; do + #echo $item + ${destFile} ${item} LOGO=addigy NOTIFY=silent BLOCKING_PROCESS_ACTION=quit_kill #INSTALL=force + if [ $? != 0 ]; then + # Error handling + echo "[$(DATE)] Error installing ${item}. Exit code $?" + let errorCount++ + # exit $? + fi +done + +echo +echo "Errors: $errorCount" +echo "[$(DATE)][LOG-END]" + +exit $errorCount + +# Mark: Conditions +# Install on success +# Remember to fill out the correct “TARGET_VERSION” and “PKG_ID”, and click "Install on succes". +PKG_ID="com.scriptingosx.Installomator" +TARGET_VERSION="0.7.0" + +vercomp () { + if [[ $1 == $2 ]]; then + return 0 + fi + local IFS=. + local i ver1=($1) ver2=($2) + # fill empty fields in ver1 with zeros + for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do + ver1[i]=0 + done + for ((i=0; i<${#ver1[@]}; i++)); do + if [[ -z ${ver2[i]} ]]; then + # fill empty fields in ver2 with zeros + ver2[i]=0 + fi + if ((10#${ver1[i]} > 10#${ver2[i]})); then + return 1 + fi + if ((10#${ver1[i]} < 10#${ver2[i]})); then + return 2 + fi + done + return 0 +} + +INSTALLED_VERSION="$(pkgutil --pkg-info $PKG_ID | grep -i "^version" | awk '{print $2}')" + +echo "Current Version: ${INSTALLED_VERSION}" + +vercomp ${TARGET_VERSION} ${INSTALLED_VERSION} +COMP=$? # 0 means the same, 1 means TARGET is newer, 2 means INSTALLED is newer +echo "COMPARISON: ${COMP}" + +if [ "${COMP}" -eq 1 ]; then + echo "Installed version is older than ${TARGET_VERSION}." + exit 0 +else + echo "Installed version is the same or newer than ${TARGET_VERSION}." + exit 1 +fi diff --git a/MDM/Manual valuesfromarguments.sh b/MDM/Manual valuesfromarguments.sh new file mode 100755 index 0000000..b46a5fd --- /dev/null +++ b/MDM/Manual valuesfromarguments.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Installation using Installomator +# Example of installing software using valuesfromarguments to install a custom software + +what="valuesfromarguments" # enter the software to install + +# 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 + +${destFile} valuesfromarguments \ + name=\"Zoho\ WorkDrive\" \ + type=dmg \ + downloadURL=https://files-accl.zohopublic.com/public/wdbin/download/46f971e4fc4a32b68ad5d7dade38a7d2 \ + appNewVersion=2.6.25 \ + expectedTeamID=TZ824L8Y37 \ + BLOCKING_PROCESS_ACTION=quit \ + NOTIFY=all + +# ${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 $?" + exit $? +fi + +echo "[$(DATE)][LOG-END]" + +exit 0 diff --git a/MDM/RemoveInstallomator.sh b/MDM/RemoveInstallomator.sh new file mode 100644 index 0000000..8a6b405 --- /dev/null +++ b/MDM/RemoveInstallomator.sh @@ -0,0 +1,13 @@ +#!/bin/zsh + +# how to remove Installomator. + +# Mark: This fork +pkgutil --forget "com.scriptingosx.Installomator" +rm /usr/local/Installomator/Installomator.sh +rmdir /usr/local/Installomator + +# Mark: Theile fork +pkgutil --forget "dk.theilgaard.pkg.Installomator" +rm /usr/local/bin/Installomator.sh +rm /usr/local/bin/InstallomatorLabels.sh