Merge branch 'main' into libreoffice

This commit is contained in:
Søren Theilgaard
2022-09-30 22:08:16 +02:00
committed by GitHub
143 changed files with 7003 additions and 922 deletions

View File

@@ -1,3 +1,100 @@
## v10beta2
- fixed problem with GitHub labels (#659)
- bz2 archive support (#659)
- fixed WorkspaceOne support (#653)
Plus everything from v10beta1
- new labels:
- abetterfinderrename11 (#552)
- carboncopycloner (#553)
- cocoapods (#659)
- coconutbattery (#588)
- cricutdesignspace (#562)
- dynalist (#591)
- fellow (#591)
- flexoptixapp (#554)
- googleadseditor (#652, #541)
- kap (#568)
- keepingyouawake (#549)
- lcadvancedvpnclient (#584)
- masv (#569)
- merlinproject (#555)
- mongodbcompass (#654)
- netspot (#556)
- relatel (#619)
- sonicvisualiser (#575)
- strongdm (#559)
- synologyassistant (#557)
- synologydriveclient (#582)
- tencentmeeting (#570)
- typinator (#583)
- xcreds (#675)
- updated labels:
- acroniscyberprotectconnect/remotix (#664)
- acroniscyberprotectconnectagent/remotixagent (#664)
- awsvpnclient (#586)
- boxtools (#589)
- clevershare2 (#664)
- coderunner (#664)
- colourcontrastanalyser (#664)
- cryptomator (#664)
- dangerzone (#664)
- drawio (#664)
- golang (#664)
- icons (#664)
- insomnia (#664)
- knockknock (#664)
- libreoffice (#672)
- macports
- opera (#664)
- supportapp (#664)
- vmwarehorizonclient (#645, #511)
- deleted/deactivated labels:
- microsoftyammer (#664)
- wickrme (#664)
- wickrpro (#664)
## v10beta1
- [swiftDialog](https://github.com/bartreardon/swiftDialog) integration (#641, #632), many thanks to @bartreardon, [sample scripts](in the MDM folder)
- added WorkspaceOne option for LOGO (#517)
- added function for JSON parsing with JXA (#529)
- updated assemble.sh script to update Labels.txt when script is rebuilt (#540)
- added a no requisite install script (#493)
- GitHub lookup now don't use API calls, this should avoid or at least reduce rate limiting (#543)
- fixed redundant exit codes (#643, #561)
NOTE: some exit codes have changed! see [Installomator Exit Codes](https://github.com/Installomator/Installomator/wiki/Installomator-Exit-Codes) for a list
- new labels:
- bluejeanswithaudiodriver (#473)
- duodevicehealth (#548)
- googlechromeenterprise (#532)
- ipswupdater (#545)
- mmhmm (#571)
- nordlayer (#419)
- prune (#538)
- whatroute (#560)
- updated labels:
- blender (#535, #622)
- camtasia2019 (#547)
- clickshare (#565)
- egnyte (#500)
- googledrive (#563)
- grammarly (#576)
- marathon, marathon2, marathoninfinity (#544)
- miro (#475, #539)
- notion (#566)
- ringcentralapp (#550)
- sublimetext (#593, #578, #567, #623, #626)
- talkdeskcallbar (#536)
- talkdeskcxcloud (#537)
- wireshark (#585)
## v9.2
**Note**: Both Google and Mozilla recommend using the pkg installers instead of the dmg downloads for managed deployments. So far, Installomator has provided labels for both. (`googlechrome` and `googlechromepkg` or `firefox` and `firefoxpkg`, respectively) Since there are problems with the dmg downloads, a future release of Installomator will _disable_ the `firefox` and `googlechrome` dmg labels. You should switch to using `googlechromepkg` and `firefoxpkg` labels instead.

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,10 @@
1passwordcli
4kvideodownloader
8x8
abetterfinderrename11
abstract
acroniscyberprotectconnect
acroniscyberprotectconnectagent
adobebrackets
adobeconnect
adobecreativeclouddesktop
@@ -56,6 +59,7 @@ bettertouchtool
bitwarden
blender
bluejeans
bluejeanswithaudiodriver
boxdrive
boxsync
boxtools
@@ -71,6 +75,7 @@ camtasia2019
camtasia2020
camtasia2021
canva
carboncopycloner
chatwork
cisdem-documentreader
citrixworkspace
@@ -81,12 +86,15 @@ closeio
cloudya
clue
cluefull
cocoapods
coconutbattery
code42
coderunner
colourcontrastanalyser
cormorant
craftmanager
craftmanagerforsketch
cricutdesignspace
cryptomator
cyberduck
daisydisk
@@ -110,6 +118,8 @@ drawio
drift
dropbox
duckduckgo
duodevicehealth
dynalist
easeusdatarecoverywizard
easyfind
egnyte
@@ -124,6 +134,7 @@ exifrenamer
fantastical
fastscripts
favro
fellow
ferdi
figma
filezilla
@@ -136,6 +147,7 @@ firefoxesr_intl
firefoxesrpkg
firefoxpkg
firefoxpkg_intl
flexoptixapp
flowjo
flux
flycut
@@ -145,7 +157,9 @@ fsmonitor
gimp
githubdesktop
golang
googleadseditor
googlechrome
googlechromeenterprise
googlechromepkg
googledrive
googledrivebackupandsync
@@ -181,6 +195,7 @@ insomnia
installomator
installomator_theile
intellijideace
ipswupdater
istatmenus
iterm2
itsycal
@@ -200,8 +215,10 @@ jetbrainspycharmce
jetbrainsrubymine
jetbrainstoolbox
jetbrainswebstorm
kap
karabinerelements
keepassxc
keepingyouawake
keka
keybase
keyboardmaestro
@@ -211,6 +228,7 @@ krisp
krita
lastpass
launchbar
lcadvancedvpnclient
lexarrecoverytool
libreoffice
linear
@@ -230,8 +248,10 @@ malwarebytes
marathon
marathon2
marathoninfinity
masv
mattermost
menumeters
merlinproject
microsoftautoupdate
microsoftazuredatastudio
microsoftazurestorageexplorer
@@ -255,25 +275,28 @@ microsoftskypeforbusiness
microsoftteams
microsoftvisualstudiocode
microsoftword
microsoftyammer
mightymike
mindmanager
miro
mmhmm
mobikinassistantforandroid
mochakeyboard
mochatelnet
mochatn3270
mochatn3812
mochatn5250
mongodbcompass
montereyblocker
mowgliiitsycal
musescore
muzzle
nanosaur
netnewswire
netspot
nextcloud
nomad
nomadlogin
nordlayer
notion
nudge
nvivo
@@ -317,6 +340,7 @@ promiseutilityr
propresenter7
protonvpn
proxyman
prune
pycharmce
pymol
qgis-pr
@@ -325,6 +349,7 @@ ramboxce
rancherdesktop
rectangle
redeye
relatel
remotedesktopmanagerenterprise
remotedesktopmanagerfree
remotix
@@ -369,6 +394,7 @@ snagit2020
snagit2021
snagit2022
snapgeneviewer
sonicvisualiser
sonobus
sonos
sonoss1
@@ -379,6 +405,7 @@ spotify
sqlpropostgres
sqlprostudio
steelseriesengine
strongdm
strongsync
sublimetext
superhuman
@@ -387,6 +414,8 @@ suspiciouspackage
swiftdialog
swiftruntimeforcommandlinetools
sync
synologyassistant
synologydriveclient
tableaudesktop
tableaupublic
tableaureader
@@ -400,6 +429,7 @@ teamviewerqs
techsmithcapture
telegram
tembo
tencentmeeting
textexpander
textmate
theunarchiver
@@ -413,6 +443,7 @@ torbrowser
trex
tunnelbear
tunnelblick
typinator
typora
ultimakercura
umbrellaroamingclient
@@ -437,12 +468,12 @@ webex
webexmeetings
webexteams
wechat
whatroute
whatsapp
wickrme
wickrpro
wireshark
wordservice
wwdc
xcreds
xeroxphaser7800
xeroxworkcentre7800
xink

View File

@@ -1,185 +0,0 @@
#!/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.
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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
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
echo "[$(DATE)][LOG-END]"
caffexit 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.
# Shouldnt 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 its 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

View File

@@ -0,0 +1,346 @@
#!/bin/sh
# Installation using Installomator with Dialog showing progress (and posibility of adding to the Dock)
# Installation of software using `valuesfromarguments` to install a custom software using Installomator through GitHub
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
#item="gfxcardstatus" # enter the software to install (if it has a label in future version of Installomator)
# Label variables below
# GitHub functions
downloadURLFromGit() { # $1 git user name, $2 git repo name
gitusername=${1?:"no git user name"}
gitreponame=${2?:"no git repo name"}
if [[ $type == "pkgInDmg" ]]; then
filetype="dmg"
elif [[ $type == "pkgInZip" ]]; then
filetype="zip"
else
filetype=$type
fi
if [ -n "$archiveName" ]; then
downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*$archiveName" | head -1 || true)
if [[ "$(echo $downloadURL | grep -ioE "https.*$archiveName" || true)" == "" ]]; then
#printlog "Trying GitHub API for download URL."
downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$archiveName\"/ { print \$4; exit }" || true)
fi
else
downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1 || true)
if [[ "$(echo $downloadURL | grep -ioE "https.*.$filetype" || true)" == "" ]]; then
#printlog "Trying GitHub API for download URL."
downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }" || true)
fi
fi
if [ -z "$downloadURL" ]; then
echo "could not retrieve download URL for $gitusername/$gitreponame"
exit 1
else
echo "$downloadURL"
return 0
fi
}
versionFromGit() {
# credit: Søren Theilgaard (@theilgaard)
# $1 git user name, $2 git repo name
gitusername=${1?:"no git user name"}
gitreponame=${2?:"no git repo name"}
#appNewVersion=$(curl -L --silent --fail "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | grep tag_name | cut -d '"' -f 4 | sed 's/[^0-9\.]//g' || true)
appNewVersion=$(curl -sLI "https://github.com/$gitusername/$gitreponame/releases/latest" | grep -i "^location" | tr "/" "\n" | tail -1 | sed 's/[^0-9\.]//g' || true)
if [ -z "$appNewVersion" ]; then
#echo "could not retrieve version number for $gitusername/$gitreponame"
appNewVersion=""
else
echo "$appNewVersion"
return 0
fi
}
# Variables for label
name="gfxCardStatus"
type="zip"
packageID=""
downloadURL="$(downloadURLFromGit codykrieger gfxCardStatus)"
appNewVersion="$(versionFromGit codykrieger gfxCardStatus)"
versionKey=""
expectedTeamID="LF22FTQC25"
# Dialog icon
icon=""
# icon should be a file system path or an URL to an online PNG.
# In Mosyle an URL can be found by copy picture address from a Custom Command icon.
# dockutil variables
addToDock="1" # with dockutil after installation (0 if not)
appPath="/Applications/$name.app"
# Other variables
dialog_command_file="/var/tmp/dialog.log"
dialogApp="/Library/Application Support/Dialog/Dialog.app"
dockutil="/usr/local/bin/dockutil"
installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user DIALOG_CMD_FILE=${dialog_command_file}" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 10.0.2 : Improved icon checks and failovers
# v. 10.0.1 : github-functions added. Improved appIcon handling. Can add the app to Dock using dockutil.
# v. 10.0 : Integration with Dialog and Installomator v. 10
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
dialogUpdate() {
# $1: dialog command
local dcommand="$1"
if [[ -n $dialog_command_file ]]; then
echo "$dcommand" >> "$dialog_command_file"
echo "Dialog: $dcommand"
fi
}
checkCmdOutput () {
# $1: cmdOutput
local cmdOutput="$1"
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 "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
}
# Check the currently logged in user
currentUser=$(stat -f "%Su" /dev/console)
if [ -z "$currentUser" ] || [ "$currentUser" = "loginwindow" ] || [ "$currentUser" = "_mbsetupuser" ] || [ "$currentUser" = "root" ]; then
echo "ERROR. Logged in user is $currentUser! Cannot proceed."
exit 97
fi
# Get the current user's UID for dockutil
uid=$(id -u "$currentUser")
# Find the home folder of the user
userHome="$(dscl . -read /users/${currentUser} NFSHomeDirectory | awk '{print $2}')"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Mark: Installation begins
installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion) < "20A" ]]; then
echo "Installomator should be at least version 10 to support Dialog. Installed version $installomatorVersion."
echo "And macOS 11 Big Sur (build 20A) is required for Dialog. Installed build $(sw_vers -buildVersion)."
installomatorNotify="NOTIFY=all"
else
installomatorNotify="NOTIFY=silent"
# check for Swift Dialog
if [[ ! -d $dialogApp ]]; then
echo "Cannot find dialog at $dialogApp"
# Install using Installlomator
cmdOutput="$(${destFile} dialog LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore LOGGING=REQ NOTIFY=silent || true)"
checkCmdOutput $cmdOutput
fi
# Configure and display swiftDialog
itemName=$( ${destFile} ${item} RETURN_LABEL_NAME=1 LOGGING=REQ INSTALL=force | tail -1 || true )
if [[ "$itemName" != "#" ]]; then
message="Installing ${itemName}"
else
message="Installing ${item}"
fi
echo "$item $itemName"
#Check icon (expecting beginning with “http” to be web-link and “/” to be disk file)
echo "icon before check: $icon"
if [[ "$(echo ${icon} | grep -iE "^(http|ftp).*")" != "" ]]; then
echo "icon looks to be web-link"
if ! curl -sfL --output /dev/null -r 0-0 "${icon}" ; then
echo "ERROR: Cannot download link. Reset icon."
icon=""
fi
elif [[ "$(echo ${icon} | grep -iE "^\/.*")" != "" ]]; then
echo "icon looks to be a file"
if [[ ! -a "${icon}" ]]; then
echo "ERROR: Cannot find file. Reset icon."
icon=""
fi
else
echo "ERROR: Cannot figure out icon. Reset icon."
icon=""
fi
echo "icon after first check: $icon"
# If no icon defined we are trying to search for installed app icon
if [[ "$icon" == "" ]]; then
appPath=$(mdfind "kind:application AND name:$itemName" | head -1 || true)
appIcon=$(defaults read "${appPath}/Contents/Info.plist" CFBundleIconFile || true)
if [[ "$(echo "$appIcon" | grep -io ".icns")" == "" ]]; then
appIcon="${appIcon}.icns"
fi
icon="${appPath}/Contents/Resources/${appIcon}"
echo "Icon before file check: ${icon}"
if [ ! -f "${icon}" ]; then
# Using LOGO variable to show logo in swiftDialog
case $LOGO in
appstore)
# Apple App Store on Mac
if [[ $(sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
;;
jamf)
# Jamf Pro
LOGO_PATH="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns"
;;
mosyleb)
# Mosyle Business
LOGO_PATH="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns"
;;
mosylem)
# Mosyle Manager (education)
LOGO_PATH="/Applications/Manager.app/Contents/Resources/AppIcon.icns"
;;
addigy)
# Addigy
LOGO_PATH="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns"
;;
microsoft)
# Microsoft Endpoint Manager (Intune)
LOGO_PATH="/Library/Intune/Microsoft Intune Agent.app/Contents/Resources/AppIcon.icns"
;;
ws1)
# Workspace ONE (AirWatch)
LOGO="/Applications/Workspace ONE Intelligent Hub.app/Contents/Resources/AppIcon.icns"
;;
esac
if [[ ! -a "${LOGO_PATH}" ]]; then
printlog "ERROR in LOGO_PATH '${LOGO_PATH}', setting Mac App Store."
if [[ $(/usr/bin/sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
fi
icon="${LOGO_PATH}"
fi
fi
echo "LOGO: $LOGO"
echo "icon: ${icon}"
# display first screen
open -a "$dialogApp" --args \
--title none \
--icon "$icon" \
--message "$message" \
--mini \
--progress 100 \
--position bottomright \
--movable \
--commandfile "$dialog_command_file"
# give everything a moment to catch up
sleep 0.1
fi
# Install software using Installomator with valuesfromarguments
cmdOutput="$(${destFile} valuesfromarguments LOGO=$LOGO \
name=${name} \
type=${type} \
packageID=${packageID} \
downloadURL=\"$downloadURL\" \
appNewVersion=${appNewVersion} \
versionKey=${versionKey} \
expectedTeamID=${expectedTeamID} \
${installomatorOptions} ${installomatorNotify} || true)"
checkCmdOutput $cmdOutput
# Mark: dockutil stuff
if [[ $addToDock -eq 1 ]]; then
dialogUpdate "progresstext: Adding to Dock"
if [[ ! -d $dockutil ]]; then
echo "Cannot find dockutil at $dockutil, trying installation"
# Install using Installlomator
cmdOutput="$(${destFile} dockutil LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore LOGGING=REQ NOTIFY=silent || true)"
checkCmdOutput $cmdOutput
fi
echo "Adding to Dock"
$dockutil --add "${appPath}" "${userHome}/Library/Preferences/com.apple.dock.plist" || true
sleep 1
else
echo "Not adding to Dock."
fi
# Mark: Ending
if [[ $installomatorVersion -lt 10 ]]; then
echo "Again skipping Dialog stuff."
else
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"
# pause a moment
sleep 0.5
dialogUpdate "quit:"
# let everything catch up
sleep 0.5
# just to be safe
#killall "Dialog" 2>/dev/null || true
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -0,0 +1,293 @@
#!/bin/sh
# Installation using Installomator with Dialog showing progress (and posibility of adding to the Dock)
# Installation of software using `valuesfromarguments` to install a custom software using Installomator
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
#item="" # enter the software to install (if it has a label in future version of Installomator)
# Variables for label
name="ClickShare"
type="appInDmgInZip"
packageID=""
downloadURL="https://www.barco.com$( curl -fs "https://www.barco.com/en/clickshare/app" | grep -A6 -i "macos" | grep -i "FileNumber" | tr '"' "\n" | grep -i "FileNumber" )"
appNewVersion="$(eval "$( echo $downloadURL | sed -E 's/.*(MajorVersion.*BuildVersion=[0-9]*).*/\1/' | sed 's/&amp//g' )" ; ((MajorVersion++)) ; ((MajorVersion--)); ((MinorVersion++)) ; ((MinorVersion--)); ((PatchVersion++)) ; ((PatchVersion--)); ((BuildVersion++)) ; ((BuildVersion--)); echo "${MajorVersion}.${MinorVersion}.${PatchVersion}-b${BuildVersion}")"
versionKey=""
expectedTeamID="P6CDJZR997"
# Dialog icon
icon=""
# icon should be a file system path or an URL to an online PNG.
# In Mosyle an URL can be found by copy picture address from a Custom Command icon.
# dockutil variables
addToDock="1" # with dockutil after installation (0 if not)
appPath="/Applications/$name.app"
# Other variables
dialog_command_file="/var/tmp/dialog.log"
dialogApp="/Library/Application Support/Dialog/Dialog.app"
dockutil="/usr/local/bin/dockutil"
installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user DIALOG_CMD_FILE=${dialog_command_file}" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 10.0.2 : Improved icon checks and failovers
# v. 10.0.1 : Improved appIcon handling. Can add the app to Dock using dockutil
# v. 10.0 : Integration with Dialog and Installomator v. 10
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
dialogUpdate() {
# $1: dialog command
local dcommand="$1"
if [[ -n $dialog_command_file ]]; then
echo "$dcommand" >> "$dialog_command_file"
echo "Dialog: $dcommand"
fi
}
checkCmdOutput () {
# $1: cmdOutput
local cmdOutput="$1"
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 "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
}
# Check the currently logged in user
currentUser=$(stat -f "%Su" /dev/console)
if [ -z "$currentUser" ] || [ "$currentUser" = "loginwindow" ] || [ "$currentUser" = "_mbsetupuser" ] || [ "$currentUser" = "root" ]; then
echo "ERROR. Logged in user is $currentUser! Cannot proceed."
exit 97
fi
# Get the current user's UID for dockutil
uid=$(id -u "$currentUser")
# Find the home folder of the user
userHome="$(dscl . -read /users/${currentUser} NFSHomeDirectory | awk '{print $2}')"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Mark: Installation begins
installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion) < "20A" ]]; then
echo "Installomator should be at least version 10 to support Dialog. Installed version $installomatorVersion."
echo "And macOS 11 Big Sur (build 20A) is required for Dialog. Installed build $(sw_vers -buildVersion)."
installomatorNotify="NOTIFY=all"
else
installomatorNotify="NOTIFY=silent"
# check for Swift Dialog
if [[ ! -d $dialogApp ]]; then
echo "Cannot find dialog at $dialogApp"
# Install using Installlomator
cmdOutput="$(${destFile} dialog LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore LOGGING=REQ NOTIFY=silent || true)"
checkCmdOutput $cmdOutput
fi
# Configure and display swiftDialog
itemName=$( ${destFile} ${item} RETURN_LABEL_NAME=1 LOGGING=REQ INSTALL=force | tail -1 || true )
if [[ "$itemName" != "#" ]]; then
message="Installing ${itemName}"
else
message="Installing ${item}"
fi
echo "$item $itemName"
#Check icon (expecting beginning with “http” to be web-link and “/” to be disk file)
echo "icon before check: $icon"
if [[ "$(echo ${icon} | grep -iE "^(http|ftp).*")" != "" ]]; then
echo "icon looks to be web-link"
if ! curl -sfL --output /dev/null -r 0-0 "${icon}" ; then
echo "ERROR: Cannot download link. Reset icon."
icon=""
fi
elif [[ "$(echo ${icon} | grep -iE "^\/.*")" != "" ]]; then
echo "icon looks to be a file"
if [[ ! -a "${icon}" ]]; then
echo "ERROR: Cannot find file. Reset icon."
icon=""
fi
else
echo "ERROR: Cannot figure out icon. Reset icon."
icon=""
fi
echo "icon after first check: $icon"
# If no icon defined we are trying to search for installed app icon
if [[ "$icon" == "" ]]; then
appPath=$(mdfind "kind:application AND name:$itemName" | head -1 || true)
appIcon=$(defaults read "${appPath}/Contents/Info.plist" CFBundleIconFile || true)
if [[ "$(echo "$appIcon" | grep -io ".icns")" == "" ]]; then
appIcon="${appIcon}.icns"
fi
icon="${appPath}/Contents/Resources/${appIcon}"
echo "Icon before file check: ${icon}"
if [ ! -f "${icon}" ]; then
# Using LOGO variable to show logo in swiftDialog
case $LOGO in
appstore)
# Apple App Store on Mac
if [[ $(sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
;;
jamf)
# Jamf Pro
LOGO_PATH="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns"
;;
mosyleb)
# Mosyle Business
LOGO_PATH="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns"
;;
mosylem)
# Mosyle Manager (education)
LOGO_PATH="/Applications/Manager.app/Contents/Resources/AppIcon.icns"
;;
addigy)
# Addigy
LOGO_PATH="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns"
;;
microsoft)
# Microsoft Endpoint Manager (Intune)
LOGO_PATH="/Library/Intune/Microsoft Intune Agent.app/Contents/Resources/AppIcon.icns"
;;
ws1)
# Workspace ONE (AirWatch)
LOGO="/Applications/Workspace ONE Intelligent Hub.app/Contents/Resources/AppIcon.icns"
;;
esac
if [[ ! -a "${LOGO_PATH}" ]]; then
printlog "ERROR in LOGO_PATH '${LOGO_PATH}', setting Mac App Store."
if [[ $(/usr/bin/sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
fi
icon="${LOGO_PATH}"
fi
fi
echo "LOGO: $LOGO"
echo "icon: ${icon}"
# display first screen
open -a "$dialogApp" --args \
--title none \
--icon "$icon" \
--message "$message" \
--mini \
--progress 100 \
--position bottomright \
--movable \
--commandfile "$dialog_command_file"
# give everything a moment to catch up
sleep 0.1
fi
# Install software using Installomator with valuesfromarguments
cmdOutput="$(${destFile} valuesfromarguments LOGO=$LOGO \
name=${name} \
type=${type} \
packageID=${packageID} \
downloadURL=\"$downloadURL\" \
appNewVersion=${appNewVersion} \
versionKey=${versionKey} \
expectedTeamID=${expectedTeamID} \
${installomatorOptions} ${installomatorNotify} || true)"
checkCmdOutput $cmdOutput
# Mark: dockutil stuff
if [[ $addToDock -eq 1 ]]; then
dialogUpdate "progresstext: Adding to Dock"
if [[ ! -d $dockutil ]]; then
echo "Cannot find dockutil at $dockutil, trying installation"
# Install using Installlomator
cmdOutput="$(${destFile} dockutil LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore LOGGING=REQ NOTIFY=silent || true)"
checkCmdOutput $cmdOutput
fi
echo "Adding to Dock"
$dockutil --add "${appPath}" "${userHome}/Library/Preferences/com.apple.dock.plist" || true
sleep 1
else
echo "Not adding to Dock."
fi
# Mark: Ending
if [[ $installomatorVersion -lt 10 ]]; then
echo "Again skipping Dialog stuff."
else
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"
# pause a moment
sleep 0.5
dialogUpdate "quit:"
# let everything catch up
sleep 0.5
# just to be safe
#killall "Dialog" 2>/dev/null || true
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -0,0 +1,275 @@
#!/bin/sh
# Installation using Installomator with Dialog showing progress (and posibility of adding to the Dock)
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
item="" # enter the software to install
# Examples: brave, duckduckgo, firefoxpkg, googlechromepkg, microsoftedge, opera
# Dialog icon
icon=""
# icon should be a file system path or an URL to an online PNG.
# In Mosyle an URL can be found by copy picture address from a Custom Command icon.
# dockutil variables
addToDock="1" # with dockutil after installation (0 if not)
appPath="/Applications/Firefox.app"
# Other variables
dialog_command_file="/var/tmp/dialog.log"
dialogApp="/Library/Application Support/Dialog/Dialog.app"
dockutil="/usr/local/bin/dockutil"
installomatorOptions="BLOCKING_PROCESS_ACTION=tell_user_then_quit DIALOG_CMD_FILE=${dialog_command_file}" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 10.0.2 : Improved icon checks and failovers
# v. 10.0.1 : Improved appIcon handling. Can add the app to Dock using dockutil
# v. 10.0 : Integration with Dialog and Installomator v. 10
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
dialogUpdate() {
# $1: dialog command
local dcommand="$1"
if [[ -n $dialog_command_file ]]; then
echo "$dcommand" >> "$dialog_command_file"
echo "Dialog: $dcommand"
fi
}
checkCmdOutput () {
# $1: cmdOutput
local cmdOutput="$1"
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 "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
}
# Check the currently logged in user
currentUser=$(stat -f "%Su" /dev/console)
if [ -z "$currentUser" ] || [ "$currentUser" = "loginwindow" ] || [ "$currentUser" = "_mbsetupuser" ] || [ "$currentUser" = "root" ]; then
echo "ERROR. Logged in user is $currentUser! Cannot proceed."
exit 97
fi
# Get the current user's UID for dockutil
uid=$(id -u "$currentUser")
# Find the home folder of the user
userHome="$(dscl . -read /users/${currentUser} NFSHomeDirectory | awk '{print $2}')"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Mark: Installation begins
installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion) < "20A" ]]; then
echo "Installomator should be at least version 10 to support Dialog. Installed version $installomatorVersion."
echo "And macOS 11 Big Sur (build 20A) is required for Dialog. Installed build $(sw_vers -buildVersion)."
installomatorNotify="NOTIFY=all"
else
installomatorNotify="NOTIFY=silent"
# check for Swift Dialog
if [[ ! -d $dialogApp ]]; then
echo "Cannot find dialog at $dialogApp"
# Install using Installlomator
cmdOutput="$(${destFile} dialog LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore LOGGING=REQ NOTIFY=silent || true)"
checkCmdOutput $cmdOutput
fi
# Configure and display swiftDialog
itemName=$( ${destFile} ${item} RETURN_LABEL_NAME=1 LOGGING=REQ INSTALL=force | tail -1 || true )
if [[ "$itemName" != "#" ]]; then
message="Installing ${itemName}"
else
message="Installing ${item}"
fi
echo "$item $itemName"
#Check icon (expecting beginning with “http” to be web-link and “/” to be disk file)
echo "icon before check: $icon"
if [[ "$(echo ${icon} | grep -iE "^(http|ftp).*")" != "" ]]; then
echo "icon looks to be web-link"
if ! curl -sfL --output /dev/null -r 0-0 "${icon}" ; then
echo "ERROR: Cannot download link. Reset icon."
icon=""
fi
elif [[ "$(echo ${icon} | grep -iE "^\/.*")" != "" ]]; then
echo "icon looks to be a file"
if [[ ! -a "${icon}" ]]; then
echo "ERROR: Cannot find file. Reset icon."
icon=""
fi
else
echo "ERROR: Cannot figure out icon. Reset icon."
icon=""
fi
echo "icon after first check: $icon"
# If no icon defined we are trying to search for installed app icon
if [[ "$icon" == "" ]]; then
appPath=$(mdfind "kind:application AND name:$itemName" | head -1 || true)
appIcon=$(defaults read "${appPath}/Contents/Info.plist" CFBundleIconFile || true)
if [[ "$(echo "$appIcon" | grep -io ".icns")" == "" ]]; then
appIcon="${appIcon}.icns"
fi
icon="${appPath}/Contents/Resources/${appIcon}"
echo "Icon before file check: ${icon}"
if [ ! -f "${icon}" ]; then
# Using LOGO variable to show logo in swiftDialog
case $LOGO in
appstore)
# Apple App Store on Mac
if [[ $(sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
;;
jamf)
# Jamf Pro
LOGO_PATH="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns"
;;
mosyleb)
# Mosyle Business
LOGO_PATH="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns"
;;
mosylem)
# Mosyle Manager (education)
LOGO_PATH="/Applications/Manager.app/Contents/Resources/AppIcon.icns"
;;
addigy)
# Addigy
LOGO_PATH="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns"
;;
microsoft)
# Microsoft Endpoint Manager (Intune)
LOGO_PATH="/Library/Intune/Microsoft Intune Agent.app/Contents/Resources/AppIcon.icns"
;;
ws1)
# Workspace ONE (AirWatch)
LOGO="/Applications/Workspace ONE Intelligent Hub.app/Contents/Resources/AppIcon.icns"
;;
esac
if [[ ! -a "${LOGO_PATH}" ]]; then
printlog "ERROR in LOGO_PATH '${LOGO_PATH}', setting Mac App Store."
if [[ $(/usr/bin/sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
fi
icon="${LOGO_PATH}"
fi
fi
echo "LOGO: $LOGO"
echo "icon: ${icon}"
# display first screen
open -a "$dialogApp" --args \
--title none \
--icon "$icon" \
--message "$message" \
--mini \
--progress 100 \
--position bottomright \
--movable \
--commandfile "$dialog_command_file"
# give everything a moment to catch up
sleep 0.1
fi
# Install software using Installomator
cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} ${installomatorNotify} || true)"
checkCmdOutput $cmdOutput
# Mark: dockutil stuff
if [[ $addToDock -eq 1 ]]; then
dialogUpdate "progresstext: Adding to Dock"
if [[ ! -d $dockutil ]]; then
echo "Cannot find dockutil at $dockutil, trying installation"
# Install using Installlomator
cmdOutput="$(${destFile} dockutil LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore LOGGING=REQ NOTIFY=silent || true)"
checkCmdOutput $cmdOutput
fi
echo "Adding to Dock"
$dockutil --add "${appPath}" "${userHome}/Library/Preferences/com.apple.dock.plist" || true
sleep 1
else
echo "Not adding to Dock."
fi
# Mark: Ending
if [[ $installomatorVersion -lt 10 ]]; then
echo "Again skipping Dialog stuff."
else
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"
# pause a moment
sleep 0.5
dialogUpdate "quit:"
# let everything catch up
sleep 0.5
# just to be safe
#killall "Dialog" 2>/dev/null || true
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -0,0 +1,278 @@
#!/bin/sh
# Installation using Installomator with Dialog showing progress (and posibility of adding to the Dock)
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
item="microsoftoffice365" # enter the software to install
# Examples: microsoftofficebusinesspro, microsoftoffice365
# Dialog icon
icon=""
# icon should be a file system path or an URL to an online PNG.
# In Mosyle an URL can be found by copy picture address from a Custom Command icon.
# dockutil variables
addToDock="1" # with dockutil after installation (0 if not)
appPaths=("/Applications/Microsoft Outlook.app" "/Applications/Microsoft Word.app" "/Applications/Microsoft Excel.app" "/Applications/Microsoft PowerPoint.app" "/Applications/Microsoft OneNote.app")
# Other variables
dialog_command_file="/var/tmp/dialog.log"
dialogApp="/Library/Application Support/Dialog/Dialog.app"
dockutil="/usr/local/bin/dockutil"
installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user DIALOG_CMD_FILE=${dialog_command_file}" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 10.0.2 : Improved icon checks and failovers
# v. 10.0.1 : Improved appIcon handling. Can add the app to Dock using dockutil
# v. 10.0 : Integration with Dialog and Installomator v. 10
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
dialogUpdate() {
# $1: dialog command
local dcommand="$1"
if [[ -n $dialog_command_file ]]; then
echo "$dcommand" >> "$dialog_command_file"
echo "Dialog: $dcommand"
fi
}
checkCmdOutput () {
# $1: cmdOutput
local cmdOutput="$1"
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 "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
}
# Check the currently logged in user
currentUser=$(stat -f "%Su" /dev/console)
if [ -z "$currentUser" ] || [ "$currentUser" = "loginwindow" ] || [ "$currentUser" = "_mbsetupuser" ] || [ "$currentUser" = "root" ]; then
echo "ERROR. Logged in user is $currentUser! Cannot proceed."
exit 97
fi
# Get the current user's UID for dockutil
uid=$(id -u "$currentUser")
# Find the home folder of the user
userHome="$(dscl . -read /users/${currentUser} NFSHomeDirectory | awk '{print $2}')"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Mark: Installation begins
installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion) < "20A" ]]; then
echo "Installomator should be at least version 10 to support Dialog. Installed version $installomatorVersion."
echo "And macOS 11 Big Sur (build 20A) is required for Dialog. Installed build $(sw_vers -buildVersion)."
installomatorNotify="NOTIFY=all"
else
installomatorNotify="NOTIFY=silent"
# check for Swift Dialog
if [[ ! -d $dialogApp ]]; then
echo "Cannot find dialog at $dialogApp"
# Install using Installlomator
cmdOutput="$(${destFile} dialog LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore LOGGING=REQ NOTIFY=silent || true)"
checkCmdOutput $cmdOutput
fi
# Configure and display swiftDialog
itemName=$( ${destFile} ${item} RETURN_LABEL_NAME=1 LOGGING=REQ INSTALL=force | tail -1 || true )
if [[ "$itemName" != "#" ]]; then
message="Installing ${itemName}"
else
message="Installing ${item}"
fi
echo "$item $itemName"
#Check icon (expecting beginning with “http” to be web-link and “/” to be disk file)
echo "icon before check: $icon"
if [[ "$(echo ${icon} | grep -iE "^(http|ftp).*")" != "" ]]; then
echo "icon looks to be web-link"
if ! curl -sfL --output /dev/null -r 0-0 "${icon}" ; then
echo "ERROR: Cannot download link. Reset icon."
icon=""
fi
elif [[ "$(echo ${icon} | grep -iE "^\/.*")" != "" ]]; then
echo "icon looks to be a file"
if [[ ! -a "${icon}" ]]; then
echo "ERROR: Cannot find file. Reset icon."
icon=""
fi
else
echo "ERROR: Cannot figure out icon. Reset icon."
icon=""
fi
echo "icon after first check: $icon"
# If no icon defined we are trying to search for installed app icon
if [[ "$icon" == "" ]]; then
appPath=$(mdfind "kind:application AND name:$itemName" | head -1 || true)
appIcon=$(defaults read "${appPath}/Contents/Info.plist" CFBundleIconFile || true)
if [[ "$(echo "$appIcon" | grep -io ".icns")" == "" ]]; then
appIcon="${appIcon}.icns"
fi
icon="${appPath}/Contents/Resources/${appIcon}"
echo "Icon before file check: ${icon}"
if [ ! -f "${icon}" ]; then
# Using LOGO variable to show logo in swiftDialog
case $LOGO in
appstore)
# Apple App Store on Mac
if [[ $(sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
;;
jamf)
# Jamf Pro
LOGO_PATH="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns"
;;
mosyleb)
# Mosyle Business
LOGO_PATH="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns"
;;
mosylem)
# Mosyle Manager (education)
LOGO_PATH="/Applications/Manager.app/Contents/Resources/AppIcon.icns"
;;
addigy)
# Addigy
LOGO_PATH="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns"
;;
microsoft)
# Microsoft Endpoint Manager (Intune)
LOGO_PATH="/Library/Intune/Microsoft Intune Agent.app/Contents/Resources/AppIcon.icns"
;;
ws1)
# Workspace ONE (AirWatch)
LOGO="/Applications/Workspace ONE Intelligent Hub.app/Contents/Resources/AppIcon.icns"
;;
esac
if [[ ! -a "${LOGO_PATH}" ]]; then
printlog "ERROR in LOGO_PATH '${LOGO_PATH}', setting Mac App Store."
if [[ $(/usr/bin/sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
fi
icon="${LOGO_PATH}"
fi
fi
echo "LOGO: $LOGO"
echo "icon: ${icon}"
# display first screen
open -a "$dialogApp" --args \
--title none \
--icon "$icon" \
--message "$message" \
--mini \
--progress 100 \
--position bottomright \
--movable \
--commandfile "$dialog_command_file"
# give everything a moment to catch up
sleep 0.1
fi
# Install software using Installomator
cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} ${installomatorNotify} || true)"
checkCmdOutput $cmdOutput
# Mark: dockutil stuff
if [[ $addToDock -eq 1 ]]; then
dialogUpdate "progresstext: Adding to Dock"
if [[ ! -d $dockutil ]]; then
echo "Cannot find dockutil at $dockutil, trying installation"
# Install using Installlomator
cmdOutput="$(${destFile} dockutil LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore LOGGING=REQ NOTIFY=silent || true)"
checkCmdOutput $cmdOutput
fi
echo "Adding to Dock"
for appPath in "${appPaths[@]}"; do
$dockutil --add "${appPath}" "${userHome}/Library/Preferences/com.apple.dock.plist" --no-restart || true
done
$dockutil --add "/AppThatDoesNotExistAnywhereOnDiskButMakingDockutilRestartTheDock" "${userHome}/Library/Preferences/com.apple.dock.plist" || true
sleep 1
else
echo "Not adding to Dock."
fi
# Mark: Ending
if [[ $installomatorVersion -lt 10 ]]; then
echo "Again skipping Dialog stuff."
else
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"
# pause a moment
sleep 0.5
dialogUpdate "quit:"
# let everything catch up
sleep 0.5
# just to be safe
#killall "Dialog" 2>/dev/null || true
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -0,0 +1,272 @@
#!/bin/sh
# Installation using Installomator with Dialog showing progress (and posibility of adding to the Dock)
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
item="" # enter the software to install
# Examples: adobecreativeclouddesktop, canva, cyberduck, handbrake, inkscape, textmate, vlc
# Dialog icon
icon=""
# icon should be a file system path or an URL to an online PNG, so beginning with either “/” or “http”.
# In Mosyle an URL can be found by copy picture address from a Custom Command icon.
# dockutil variables
addToDock="0" # with dockutil after installation (0 if not)
appPath="/Applications/Cyberduck.app"
# Other variables
dialog_command_file="/var/tmp/dialog.log"
dialogApp="/Library/Application Support/Dialog/Dialog.app"
dockutil="/usr/local/bin/dockutil"
installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user DIALOG_CMD_FILE=${dialog_command_file}" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 10.0.2 : Improved icon checks and failovers
# v. 10.0.1 : Improved appIcon handling. Can add the app to Dock using dockutil
# v. 10.0 : Integration with Dialog and Installomator v. 10
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
dialogUpdate() {
# $1: dialog command
local dcommand="$1"
if [[ -n $dialog_command_file ]]; then
echo "$dcommand" >> "$dialog_command_file"
echo "Dialog: $dcommand"
fi
}
checkCmdOutput () {
# $1: cmdOutput
local cmdOutput="$1"
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 "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
}
# Check the currently logged in user
currentUser=$(stat -f "%Su" /dev/console)
if [ -z "$currentUser" ] || [ "$currentUser" = "loginwindow" ] || [ "$currentUser" = "_mbsetupuser" ] || [ "$currentUser" = "root" ]; then
echo "ERROR. Logged in user is $currentUser! Cannot proceed."
exit 97
fi
# Get the current user's UID for dockutil
uid=$(id -u "$currentUser")
# Find the home folder of the user
userHome="$(dscl . -read /users/${currentUser} NFSHomeDirectory | awk '{print $2}')"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Mark: Installation begins
installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion) < "20A" ]]; then
echo "Installomator should be at least version 10 to support Dialog. Installed version $installomatorVersion."
echo "And macOS 11 Big Sur (build 20A) is required for Dialog. Installed build $(sw_vers -buildVersion)."
installomatorNotify="NOTIFY=all"
else
installomatorNotify="NOTIFY=silent"
# check for Swift Dialog
if [[ ! -d $dialogApp ]]; then
echo "Cannot find dialog at $dialogApp"
# Install using Installlomator
cmdOutput="$(${destFile} dialog LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore LOGGING=REQ NOTIFY=silent || true)"
checkCmdOutput $cmdOutput
fi
# Configure and display swiftDialog
itemName=$( ${destFile} ${item} RETURN_LABEL_NAME=1 LOGGING=REQ INSTALL=force | tail -1 || true )
if [[ "$itemName" != "#" ]]; then
message="Installing ${itemName}"
else
message="Installing ${item}"
fi
echo "$item $itemName"
#Check icon (expecting beginning with “http” to be web-link and “/” to be disk file)
echo "icon before check: $icon"
if [[ "$(echo ${icon} | grep -iE "^(http|ftp).*")" != "" ]]; then
echo "icon looks to be web-link"
if ! curl -sfL --output /dev/null -r 0-0 "${icon}" ; then
echo "ERROR: Cannot download link. Reset icon."
icon=""
fi
elif [[ "$(echo ${icon} | grep -iE "^\/.*")" != "" ]]; then
echo "icon looks to be a file"
if [[ ! -a "${icon}" ]]; then
echo "ERROR: Cannot find file. Reset icon."
icon=""
fi
else
echo "ERROR: Cannot figure out icon. Reset icon."
icon=""
fi
echo "icon after first check: $icon"
# If no icon defined we are trying to search for installed app icon
if [[ "$icon" == "" ]]; then
appPath=$(mdfind "kind:application AND name:$itemName" | head -1 || true)
appIcon=$(defaults read "${appPath}/Contents/Info.plist" CFBundleIconFile || true)
if [[ "$(echo "$appIcon" | grep -io ".icns")" == "" ]]; then
appIcon="${appIcon}.icns"
fi
icon="${appPath}/Contents/Resources/${appIcon}"
echo "Icon before file check: ${icon}"
if [ ! -f "${icon}" ]; then
# Using LOGO variable to show logo in swiftDialog
case $LOGO in
appstore)
# Apple App Store on Mac
if [[ $(sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
;;
jamf)
# Jamf Pro
LOGO_PATH="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns"
;;
mosyleb)
# Mosyle Business
LOGO_PATH="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns"
;;
mosylem)
# Mosyle Manager (education)
LOGO_PATH="/Applications/Manager.app/Contents/Resources/AppIcon.icns"
;;
addigy)
# Addigy
LOGO_PATH="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns"
;;
microsoft)
# Microsoft Endpoint Manager (Intune)
LOGO_PATH="/Library/Intune/Microsoft Intune Agent.app/Contents/Resources/AppIcon.icns"
;;
ws1)
# Workspace ONE (AirWatch)
LOGO="/Applications/Workspace ONE Intelligent Hub.app/Contents/Resources/AppIcon.icns"
;;
esac
if [[ ! -a "${LOGO_PATH}" ]]; then
printlog "ERROR in LOGO_PATH '${LOGO_PATH}', setting Mac App Store."
if [[ $(/usr/bin/sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
fi
icon="${LOGO_PATH}"
fi
fi
echo "LOGO: $LOGO"
echo "icon: ${icon}"
# display first screen
open -a "$dialogApp" --args \
--title none \
--icon "$icon" \
--message "$message" \
--mini \
--progress 100 \
--position bottomright \
--movable \
--commandfile "$dialog_command_file"
# give everything a moment to catch up
sleep 0.1
fi
# Install software using Installomator
cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} ${installomatorNotify} || true)"
checkCmdOutput $cmdOutput
# Mark: dockutil stuff
if [[ $addToDock -eq 1 ]]; then
dialogUpdate "progresstext: Adding to Dock"
if [[ ! -d $dockutil ]]; then
echo "Cannot find dockutil at $dockutil, trying installation"
# Install using Installlomator
cmdOutput="$(${destFile} dockutil LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore LOGGING=REQ NOTIFY=silent || true)"
checkCmdOutput $cmdOutput
fi
echo "Adding to Dock"
$dockutil --add "${appPath}" "${userHome}/Library/Preferences/com.apple.dock.plist" || true
sleep 1
else
echo "Not adding to Dock."
fi
# Mark: Ending
if [[ $installomatorVersion -lt 10 ]]; then
echo "Again skipping Dialog stuff."
else
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"
# pause a moment
sleep 0.5
dialogUpdate "quit:"
# let everything catch up
sleep 0.5
# just to be safe
#killall "Dialog" 2>/dev/null || true
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -0,0 +1,275 @@
#!/bin/sh
# Installation using Installomator
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
item="" # enter the software to install
# Examples: applenyfonts, applesfarabic, applesfcompact, applesfmono, applesfpro, applesfsymbols, desktoppr, dialog, dockutil, knockknock, lulu, nomad, nudge, shield, supportapp, wordservice, xcreds, xink
# Dialog icon
icon=""
# icon should be a file system path or an URL to an online PNG.
# In Mosyle an URL can be found by copy picture address from a Custom Command icon.
# dockutil variables
addToDock="1" # with dockutil after installation (0 if not)
appPath="/Applications/Xink.app"
# Other variables
dialog_command_file="/var/tmp/dialog.log"
dialogApp="/Library/Application Support/Dialog/Dialog.app"
dockutil="/usr/local/bin/dockutil"
installomatorOptions="BLOCKING_PROCESS_ACTION=ignore NOTIFY=silent DIALOG_CMD_FILE=${dialog_command_file}" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 10.0.2 : Improved icon checks and failovers
# v. 10.0.1 : Can add the app to Dock using dockutil
# v. 10.0 : Integration with Dialog and Installomator v. 10
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
dialogUpdate() {
# $1: dialog command
local dcommand="$1"
if [[ -n $dialog_command_file ]]; then
echo "$dcommand" >> "$dialog_command_file"
echo "Dialog: $dcommand"
fi
}
checkCmdOutput () {
# $1: cmdOutput
local cmdOutput="$1"
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 "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
}
# Check the currently logged in user
currentUser=$(stat -f "%Su" /dev/console)
if [ -z "$currentUser" ] || [ "$currentUser" = "loginwindow" ] || [ "$currentUser" = "_mbsetupuser" ] || [ "$currentUser" = "root" ]; then
echo "ERROR. Logged in user is $currentUser! Cannot proceed."
exit 97
fi
# Get the current user's UID for dockutil
uid=$(id -u "$currentUser")
# Find the home folder of the user
userHome="$(dscl . -read /users/${currentUser} NFSHomeDirectory | awk '{print $2}')"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Mark: Installation begins
installomatorVersion="$(${destFile} version | cut -d "." -f1 || true)"
if [[ $installomatorVersion -lt 10 ]] || [[ $(sw_vers -buildVersion) < "20A" ]]; then
echo "Installomator should be at least version 10 to support Dialog. Installed version $installomatorVersion."
echo "And macOS 11 Big Sur (build 20A) is required for Dialog. Installed build $(sw_vers -buildVersion)."
installomatorNotify="NOTIFY=all"
else
installomatorNotify="NOTIFY=silent"
# check for Swift Dialog
if [[ ! -d $dialogApp ]]; then
echo "Cannot find dialog at $dialogApp"
# Install using Installlomator
cmdOutput="$(${destFile} dialog LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore LOGGING=REQ NOTIFY=silent || true)"
checkCmdOutput $cmdOutput
fi
# Configure and display swiftDialog
itemName=$( ${destFile} ${item} RETURN_LABEL_NAME=1 LOGGING=REQ INSTALL=force | tail -1 || true )
if [[ "$itemName" != "#" ]]; then
message="Installing ${itemName}"
else
message="Installing ${item}"
fi
echo "$item $itemName"
#Check icon (expecting beginning with “http” to be web-link and “/” to be disk file)
echo "icon before check: $icon"
if [[ "$(echo ${icon} | grep -iE "^(http|ftp).*")" != "" ]]; then
echo "icon looks to be web-link"
if ! curl -sfL --output /dev/null -r 0-0 "${icon}" ; then
echo "ERROR: Cannot download link. Reset icon."
icon=""
fi
elif [[ "$(echo ${icon} | grep -iE "^\/.*")" != "" ]]; then
echo "icon looks to be a file"
if [[ ! -a "${icon}" ]]; then
echo "ERROR: Cannot find file. Reset icon."
icon=""
fi
else
echo "ERROR: Cannot figure out icon. Reset icon."
icon=""
fi
echo "icon after first check: $icon"
# If no icon defined we are trying to search for installed app icon
if [[ "$icon" == "" ]]; then
appPath=$(mdfind "kind:application AND name:$itemName" | head -1 || true)
appIcon=$(defaults read "${appPath}/Contents/Info.plist" CFBundleIconFile || true)
if [[ "$(echo "$appIcon" | grep -io ".icns")" == "" ]]; then
appIcon="${appIcon}.icns"
fi
icon="${appPath}/Contents/Resources/${appIcon}"
echo "Icon before file check: ${icon}"
if [ ! -f "${icon}" ]; then
# Using LOGO variable to show logo in swiftDialog
case $LOGO in
appstore)
# Apple App Store on Mac
if [[ $(sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
;;
jamf)
# Jamf Pro
LOGO_PATH="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns"
;;
mosyleb)
# Mosyle Business
LOGO_PATH="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns"
;;
mosylem)
# Mosyle Manager (education)
LOGO_PATH="/Applications/Manager.app/Contents/Resources/AppIcon.icns"
;;
addigy)
# Addigy
LOGO_PATH="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns"
;;
microsoft)
# Microsoft Endpoint Manager (Intune)
LOGO_PATH="/Library/Intune/Microsoft Intune Agent.app/Contents/Resources/AppIcon.icns"
;;
ws1)
# Workspace ONE (AirWatch)
LOGO="/Applications/Workspace ONE Intelligent Hub.app/Contents/Resources/AppIcon.icns"
;;
esac
if [[ ! -a "${LOGO_PATH}" ]]; then
printlog "ERROR in LOGO_PATH '${LOGO_PATH}', setting Mac App Store."
if [[ $(/usr/bin/sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
fi
icon="${LOGO_PATH}"
fi
fi
echo "LOGO: $LOGO"
echo "icon: ${icon}"
# display first screen
open -a "$dialogApp" --args \
--title none \
--icon "$icon" \
--message "$message" \
--mini \
--progress 100 \
--position bottomright \
--movable \
--commandfile "$dialog_command_file"
# give everything a moment to catch up
sleep 0.1
fi
# Install software using Installomator
cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} ${installomatorNotify} || true)"
checkCmdOutput $cmdOutput
# Mark: dockutil stuff
if [[ $addToDock -eq 1 ]]; then
dialogUpdate "progresstext: Adding to Dock"
if [[ ! -d $dockutil ]]; then
echo "Cannot find dockutil at $dockutil, trying installation"
# Install using Installlomator
cmdOutput="$(${destFile} dockutil LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore LOGGING=REQ NOTIFY=silent || true)"
checkCmdOutput $cmdOutput
fi
echo "Adding to Dock"
$dockutil --add "${appPath}" "${userHome}/Library/Preferences/com.apple.dock.plist" || true
sleep 1
else
echo "Not adding to Dock."
fi
# Mark: Ending
if [[ $installomatorVersion -lt 10 ]]; then
echo "Again skipping Dialog stuff."
else
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"
# pause a moment
sleep 0.5
dialogUpdate "quit:"
# let everything catch up
sleep 0.5
# just to be safe
#killall "Dialog" 2>/dev/null || true
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

98
MDM/App-install/App VFA.sh Executable file
View File

@@ -0,0 +1,98 @@
#!/bin/sh
# Installation using Installomator
# Installation of software using valuesfromarguments to install a custom software using Installomator
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
#item="" # enter the software to install (if it has a label in future version of Installomator)
# Variables for label
name="ClickShare"
type="appInDmgInZip"
packageID=""
downloadURL="https://www.barco.com$( curl -fs "https://www.barco.com/en/clickshare/app" | grep -A6 -i "macos" | grep -i "FileNumber" | tr '"' "\n" | grep -i "FileNumber" )"
appNewVersion="$(eval "$( echo $downloadURL | sed -E 's/.*(MajorVersion.*BuildVersion=[0-9]*).*/\1/' | sed 's/&amp//g' )" ; ((MajorVersion++)) ; ((MajorVersion--)); ((MinorVersion++)) ; ((MinorVersion--)); ((PatchVersion++)) ; ((PatchVersion--)); ((BuildVersion++)) ; ((BuildVersion--)); echo "${MajorVersion}.${MinorVersion}.${PatchVersion}-b${BuildVersion}")"
versionKey=""
expectedTeamID="P6CDJZR997"
installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user LOGGING=INFO NOTIFY=all" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "what" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $what"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Install software using Installomator with valuesfromarguments
cmdOutput="$(${destFile} valuesfromarguments LOGO=$LOGO \
name=\"${name}\" \
type=${type} \
packageID=${packageID} \
downloadURL=\"$downloadURL\" \
appNewVersion=${appNewVersion} \
versionKey=${versionKey} \
expectedTeamID=${expectedTeamID} \
blockingProcesses=\"NONE\" \
${installomatorOptions} || 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} -eq 0 ]] ; then
echo "${what} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${what}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -0,0 +1,79 @@
#!/bin/sh
# Installation using Installomator
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
item="firefoxpkg" # enter the software to install
# Examples: brave, duckduckgo, firefoxpkg, googlechromepkg, microsoftedge, opera
installomatorOptions="BLOCKING_PROCESS_ACTION=tell_user_then_quit" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Install software using Installomator
cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || 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} -eq 0 ]] ; then
echo "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -0,0 +1,79 @@
#!/bin/sh
# Installation using Installomator
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
item="" # enter the software to install
# Examples: brave, duckduckgo, firefoxpkg, googlechromepkg, microsoftedge, opera
installomatorOptions="BLOCKING_PROCESS_ACTION=tell_user_then_quit NOTIFY=all" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "what" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $what"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Install software using Installomator
cmdOutput="$(${destFile} ${what} LOGO=$LOGO ${installomatorOptions} || 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} -eq 0 ]] ; then
echo "${what} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${what}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -0,0 +1,79 @@
#!/bin/sh
# Installation using Installomator
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
item="" # enter the software to install
# Examples: adobecreativeclouddesktop, textmate, vlc
installomatorOptions="BLOCKING_PROCESS_ACTION=tell_user" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Install software using Installomator
cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || 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} -eq 0 ]] ; then
echo "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -0,0 +1,80 @@
#!/bin/sh
# Installation using Installomator
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
item="" # enter the software to install
# Examples: adobecreativeclouddesktop, canva, cyberduck, handbrake, inkscape, textmate, vlc
installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user NOTIFY=all" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Install software using Installomator
cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || 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} -eq 0 ]] ; then
echo "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -0,0 +1,79 @@
#!/bin/sh
# Installation using Installomator
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
item="dockutil" # enter the software to install
# Examples: applenyfonts, applesfarabic, applesfcompact, applesfmono, applesfpro, applesfsymbols, desktoppr, dialog, dockutil, knockknock, lulu, nomad, nudge, shield, supportapp, wordservice, xcreds, xink
installomatorOptions="BLOCKING_PROCESS_ACTION=ignore NOTIFY=silent" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Install software using Installomator
cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || 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} -eq 0 ]] ; then
echo "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -1,193 +0,0 @@
#!/bin/zsh
# Installation using Installomator
whatList="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 "whatList" above with labels separated by space " ".
# Script will loop through these labels.
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 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Count errors
errorCount=0
for what in $whatList; do
#echo $what
# Install software using Installomator
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"
let errorCount++
fi
done
echo
echo "Errors: $errorCount"
echo "[$(DATE)][LOG-END]"
caffexit $errorCount
# 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.
# Shouldnt 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 its 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

View File

@@ -0,0 +1,92 @@
#!/bin/sh
# Update with Installomator if app exist
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
item="microsoftedge" # enter the software to install
# Examples: brave, duckduckgo, firefoxpkg, googlechromepkg, microsoftedge, opera
appPath="/Applications/Microsoft Edge.app"
# Examples: Microsoft Edge.app, Brave Browser.app, DuckDuckGo.app, Google Chrome.app, Firefox.app, Opera.app
installomatorOptions="BLOCKING_PROCESS_ACTION=tell_user_then_quit" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
# Check if app is installed
# We only want this to run if it's already installed
if [ ! -e "${appPath}" ]; then
echo "App not found here:"
echo "${appPath}"
echo "Exiting."
exit 98
fi
echo "${appPath} Found!"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Install software using Installomator
cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || 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} -eq 0 ]] ; then
echo "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -0,0 +1,92 @@
#!/bin/sh
# Update with Installomator if app exist
LOGO="" # "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
item="" # enter the software to install
# Examples: cyberduck, handbrake, textmate, vlc
appPath="/Applications/Cyberduck.app"
# Examples: Cyberduck.app, Handbrake.app, Textmate.app, VLC.app
installomatorOptions="BLOCKING_PROCESS_ACTION=prompt_user" # Separated by space
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
# To be used as a script sent out from a MDM.
# Fill the variable "item" above with a label.
# Script will run this label through Installomator.
######################################################################
# v. 9.2.1 : Better logging handling and installomatorOptions fix.
######################################################################
# Mark: Script
# PATH declaration
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
echo "$(date +%F\ %T) [LOG-BEGIN] $item"
# Check if app is installed
# We only want this to run if it's already installed
if [ ! -e "${appPath}" ]; then
echo "App not found here:"
echo "${appPath}"
echo "Exiting."
exit 98
fi
echo "${appPath} Found!"
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Install software using Installomator
cmdOutput="$(${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || 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} -eq 0 ]] ; then
echo "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "warn" || true )"
echo "$warnOutput"
else
echo "ERROR installing ${item}. Exit code ${exitStatus}"
echo "$cmdOutput"
#errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
#echo "$errorOutput"
fi
echo "[$(DATE)][LOG-END]"
caffexit $exitStatus

View File

@@ -0,0 +1,360 @@
#!/bin/sh
# Installomator 1st installation with DEPNotify window (auto installation at enrollment)
instance="" # Name of used instance
LOGO="" # "appstore", "jamf", "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
items=(dialog dockutil microsoftautoupdate supportapp applenyfonts applesfpro applesfmono applesfcompact xink zohoworkdrivetruesync textmate 1password7 wwdc theunarchiver keka microsoftedge microsoftteams microsoftonedrive microsoftoffice365)
# Remember: dialog dockutil
installomatorOptions="NOTIFY=silent BLOCKING_PROCESS_ACTION=ignore INSTALL=force IGNORE_APP_STORE_APPS=yes LOGGING=REQ"
# DEPNotify display settings, change as desired
title="Installing Apps and other software"
message="Please wait while we download and install the needed software."
endMessage="Installation complete! Please reboot to activate FileVault."
errorMessage="A problem was encountered setting up this Mac. Please contact IT."
######################################################################
# Installomator 1st DEPNotify
#
# Installation using Installomator showing progress with DEPNotify
# Great stand-alone solution if installs are only done using Installomator.
# No customization below…
######################################################################
# This script can be used to install software using Installomator.
# Script will start DEPNotify to display a progress bar.
# Progress bar moves between installations
######################################################################
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
#
# This script made by Søren Theilgaard
# https://github.com/Theile
# Twitter and MacAdmins Slack: @theilgaard
#
# Some functions and code from Installomator:
# https://github.com/Installomator/Installomator
#
######################################################################
scriptVersion="9.5"
# v. 9.5 : 2022-09-21 : change of GitHub download
# v. 9.4 : 2022-09-14 : downloadURL can fall back on GitHub API
# v. 9.3 : 2022-08-29 : installomatorOptions in quotes and ignore blocking processes. Improved installation with looping if it fails, so it can try again. Improved GitHub handling. ws1 support.
# v. 9.2.2 : 2022-06-17 : installomatorOptions introduced. Check 1.1.1.1 for internet connection.
# v. 9.2.1 : 2022-05-30 : Some changes to logging
# v. 9.2 : 2022-05-19 : Built in installer for Installlomator, and display dialog if error happens. Now universal script for all supported MDMs based on LOGO variable.
# v. 9.1 : 2022-04-13 : Using INSTALL=force in Label only, so Microsoft labels will not start updating
# v. 9.0.1 : 2022-02-21 : LOGO=addigy, few more "true" lines, and errorOutput on error
# v. 9.0.0 : 2022-02-14 : Updated for Inst. 9.0, Logging improved with printlog
######################################################################
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Check before running
case $LOGO in
addigy|microsoft)
conditionFile="/var/db/.Installomator1stDone"
# Addigy and Microsoft Endpoint Manager (Intune) need a check for a touched file
if [ -e "$conditionFile" ]; then
echo "$LOGO setup detected"
echo "$conditionFile exists, so we exit."
exit 0
else
echo "$conditionFile not found, so we continue…"
fi
;;
esac
# Mark: Constants, logging and caffeinate
log_message="$instance: Installomator 1st with DEPNotify, v$scriptVersion"
label="1st-v$scriptVersion"
log_location="/private/var/log/Installomator.log"
printlog(){
timestamp=$(date +%F\ %T)
if [[ "$(whoami)" == "root" ]]; then
echo "$timestamp :: $label : $1" | tee -a $log_location
else
echo "$timestamp :: $label : $1"
fi
}
printlog "[LOG-BEGIN] ${log_message}"
# Internet check
if [[ "$(nc -z -v -G 10 1.1.1.1 53 2>&1 | grep -io "succeeded")" != "succeeded" ]]; then
printlog "ERROR. No internet connection, we cannot continue."
exit 90
fi
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid" || true
pkill caffeinate || true
printlog "[LOG-END] Status $1"
exit $1
}
# Command-file to DEPNotify
DEPNOTIFY_LOG="/var/tmp/depnotify.log"
# Counters
errorCount=0
countLabels=${#items[@]}
printlog "Total installations: $countLabels"
# Using LOGO variable to specify MDM and shown logo
case $LOGO in
appstore)
# Apple App Store on Mac
if [[ $(sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
;;
jamf)
# Jamf Pro
LOGO_PATH="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns"
;;
mosyleb)
# Mosyle Business
LOGO_PATH="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns"
;;
mosylem)
# Mosyle Manager (education)
LOGO_PATH="/Applications/Manager.app/Contents/Resources/AppIcon.icns"
;;
addigy)
# Addigy
LOGO_PATH="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns"
;;
microsoft)
# Microsoft Endpoint Manager (Intune)
LOGO_PATH="/Library/Intune/Microsoft Intune Agent.app/Contents/Resources/AppIcon.icns"
;;
ws1)
# Workspace ONE (AirWatch)
LOGO="/Applications/Workspace ONE Intelligent Hub.app/Contents/Resources/AppIcon.icns"
;;
esac
if [[ ! -a "${LOGO_PATH}" ]]; then
printlog "ERROR in LOGO_PATH '${LOGO_PATH}', setting Mac App Store."
if [[ $(/usr/bin/sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
fi
printlog "LOGO: $LOGO - LOGO_PATH: $LOGO_PATH"
# Mark: Functions
printlog "depnotify_command function"
echo "" > $DEPNOTIFY_LOG || true
function depnotify_command(){
printlog "DEPNotify-command: $1"
echo "$1" >> $DEPNOTIFY_LOG || true
}
printlog "startDEPNotify function"
function startDEPNotify() {
currentUser="$(stat -f "%Su" /dev/console)"
currentUserID=$(id -u "$currentUser")
launchctl asuser $currentUserID open -a "/Applications/Utilities/DEPNotify.app/Contents/MacOS/DEPNotify" --args -path "$DEPNOTIFY_LOG" || true # --args -fullScreen
sleep 5
depnotify_command "Command: KillCommandFile:"
depnotify_command "Command: MainTitle: $title"
depnotify_command "Command: Image: $LOGO_PATH"
depnotify_command "Command: MainText: $message"
depnotify_command "Command: Determinate: $countLabels"
}
# Notify the user using AppleScript
printlog "displayDialog function"
function displayDialog(){
currentUser="$(stat -f "%Su" /dev/console)"
currentUserID=$(id -u "$currentUser")
if [[ "$currentUser" != "" ]]; then
launchctl asuser $currentUserID sudo -u $currentUser osascript -e "button returned of (display dialog \"$message\" buttons {\"OK\"} default button \"OK\" with icon POSIX file \"$LOGO_PATH\")" || true
fi
}
# Mark: Code
name="Installomator"
printlog "$name check for installation"
# download URL, version and Expected Team ID
# Method for GitHub pkg
gitusername="Installomator"
gitreponame="Installomator"
#printlog "$gitusername $gitreponame"
filetype="pkg"
#downloadURL="https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
downloadURL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
if [[ "$(echo $downloadURL | grep -ioE "https.*.$filetype")" == "" ]]; then
printlog "Trying GitHub API for download URL."
downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")
fi
#printlog "$downloadURL"
appNewVersion=$(curl -sLI "https://github.com/$gitusername/$gitreponame/releases/latest" | grep -i "^location" | tr "/" "\n" | tail -1 | sed 's/[^0-9\.]//g')
#printlog "$appNewVersion"
expectedTeamID="JME5BW3F3R"
destFile="/usr/local/Installomator/Installomator.sh"
currentInstalledVersion="$(${destFile} version 2>/dev/null || true)"
printlog "${destFile} version: $currentInstalledVersion"
if [[ ! -e "${destFile}" || "$currentInstalledVersion" != "$appNewVersion" ]]; then
printlog "$name not found or version not latest."
printlog "${destFile}"
printlog "Installing version ${appNewVersion} ..."
# Create temporary working directory
tmpDir="$(mktemp -d || true)"
printlog "Created working directory '$tmpDir'"
# Download the installer package
printlog "Downloading $name package version $appNewVersion from: $downloadURL"
installationCount=0
exitCode=9
while [[ $installationCount -lt 3 && $exitCode -gt 0 ]]; do
curlDownload=$(curl -Ls "$downloadURL" -o "$tmpDir/$name.pkg" || true)
curlDownloadStatus=$(echo $?)
if [[ $curlDownloadStatus -ne 0 ]]; then
printlog "error downloading $downloadURL, with status $curlDownloadStatus"
printlog "${curlDownload}"
exitCode=1
else
printlog "Download $name succes."
# Verify the download
teamID=$(spctl -a -vv -t install "$tmpDir/$name.pkg" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' || true)
printlog "Team ID for downloaded package: $teamID"
# Install the package if Team ID validates
if [ "$expectedTeamID" = "$teamID" ] || [ "$expectedTeamID" = "" ]; then
printlog "$name package verified. Installing package '$tmpDir/$name.pkg'."
pkgInstall=$(installer -verbose -dumplog -pkg "$tmpDir/$name.pkg" -target "/" 2>&1)
pkgInstallStatus=$(echo $?)
if [[ $pkgInstallStatus -ne 0 ]]; then
printlog "ERROR. $name package installation failed."
printlog "${pkgInstall}"
exitCode=2
else
printlog "Installing $name package succes."
exitCode=0
fi
else
printlog "ERROR. Package verification failed for $name before package installation could start. Download link may be invalid."
exitCode=3
fi
fi
((installationCount++))
printlog "$installationCount time(s), exitCode $exitCode"
if [[ $installationCount -lt 3 ]]; then
if [[ $exitCode -gt 0 ]]; then
printlog "Sleep a bit before trying download and install again. $installationCount time(s)."
printlog "Remove $(rm -fv "$tmpDir/$name.pkg" || true)"
sleep 2
fi
else
printlog "Download and install of $name succes."
fi
done
# Remove the temporary working directory
printlog "Deleting working directory '$tmpDir' and its contents."
printlog "Remove $(rm -Rfv "${tmpDir}" || true)"
# Handle installation errors
if [[ $exitCode != 0 ]]; then
printlog "ERROR. Installation of $name failed. Aborting."
caffexit $exitCode
else
printlog "$name version $appNewVersion installed!"
fi
else
printlog "$name version $appNewVersion already found. Perfect!"
fi
# Installing DEPNotify
cmdOutput="$( ${destFile} depnotify LOGO=$LOGO NOTIFY=silent BLOCKING_PROCESS_ACTION=ignore LOGGING=WARN || true )"
exitStatus="$( echo "${cmdOutput}" | grep --binary-files=text -i "exit" | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' || true )"
printlog "DEPNotify install result: $exitStatus"
itemName=""
errorLabels=""
((countLabels++))
((countLabels--))
printlog "$countLabels labels to install"
startDEPNotify
for item in "${items[@]}"; do
# Check if DEPNotify is running and try open it if not
if ! pgrep -xq "DEPNotify"; then
startDEPNotify
fi
itemName=$( ${destFile} ${item} RETURN_LABEL_NAME=1 LOGGING=REQ INSTALL=force | tail -1 || true )
if [[ "$itemName" != "#" ]]; then
depnotify_command "Status: $itemName installing…"
else
depnotify_command "Status: $item installing…"
fi
printlog "$item $itemName"
cmdOutput="$( ${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || true )"
#cmdOutput="2022-05-19 13:20:45 : REQ : installomator : ################## End Installomator, exit code 0"
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
printlog "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text "WARN" || true )"
printlog "$warnOutput"
else
printlog "Error installing ${item}. Exit code ${exitStatus}"
#printlog "$cmdOutput"
errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
printlog "$errorOutput"
((errorCount++))
errorLabels="$errorLabels ${item}"
fi
((countLabels--))
itemName=""
done
# Mark: Finishing
# Prevent re-run of script if conditionFile is set
if [[ ! -z "$conditionFile" ]]; then
printlog "Touching condition file so script will not run again"
touch "$conditionFile" || true
printlog "$(ls -al "$conditionFile" || true)"
fi
# Show error to user if any
printlog "Errors: $errorCount"
if [[ $errorCount -ne 0 ]]; then
errorMessage="${errorMessage} Total errors: $errorCount"
message="$errorMessage"
displayDialog &
endMessage="$message"
printlog "errorLabels: $errorLabels"
fi
depnotify_command "Command: MainText: $endMessage"
depnotify_command "Command: Quit: $endMessage"
sleep 1
printlog "Remove $(rm -fv $DEPNOTIFY_LOG || true)"
printlog "Ending"
caffexit $errorCount

View File

@@ -0,0 +1,308 @@
#!/bin/sh
# Installomator 1st installation (auto installation at enrollment)
instance="" # Name of used instance
LOGO="" # "appstore", "jamf", "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
items=(dialog dockutil microsoftautoupdate supportapp xink zohoworkdrivetruesync textmate applenyfonts applesfpro applesfmono applesfcompact 1password7 wwdc theunarchiver keka microsoftedge microsoftteams microsoftonedrive microsoftoffice365)
# Remember: dialog dockutil
installomatorOptions="NOTIFY=silent BLOCKING_PROCESS_ACTION=ignore INSTALL=force IGNORE_APP_STORE_APPS=yes LOGGING=REQ"
# Error message to user if any occur
showError="1" # Show error message if 1 (0 if it should not be shown)
errorMessage="A problem was encountered setting up this Mac. Please contact IT."
######################################################################
# Installomator 1st
#
# Installation using Installomator
# (use separate Progress 1st script to show progress)
# No customization below…
######################################################################
# This script can be used to install software using Installomator.
# Script will display a dialog if any errors happens.
# User is not notified about installations.
######################################################################
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
#
# This script made by Søren Theilgaard
# https://github.com/Theile
# Twitter and MacAdmins Slack: @theilgaard
#
# Some functions and code from Installomator:
# https://github.com/Installomator/Installomator
#
######################################################################
scriptVersion="9.5"
# v. 9.5 : 2022-09-21 : change of GitHub download
# v. 9.4 : 2022-09-14 : Making error message optional. downloadURL can fall back on GitHub API.
# v. 9.3 : 2022-08-29 : installomatorOptions in quotes and ignore blocking processes. Improved installation with looping if it fails, so it can try again. Improved GitHub handling. ws1 support.
# v. 9.2.2 : 2022-06-17 : installomatorOptions introduced. Check 1.1.1.1 for internet connection.
# v. 9.2.1 : 2022-05-30 : Some changes to logging
# v. 9.2 : 2022-05-19 : Built in installer for Installomator, and display dialog if error happens. Now universal script for all supported MDMs based on LOGO variable.
######################################################################
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Check before running
case $LOGO in
addigy|microsoft)
conditionFile="/var/db/.Installomator1stDone"
# Addigy and Microsoft Endpoint Manager (Intune) need a check for a touched file
if [ -e "$conditionFile" ]; then
echo "$LOGO setup detected"
echo "$conditionFile exists, so we exit."
exit 0
else
echo "$conditionFile not found, so we continue…"
fi
;;
esac
# Mark: Constants, logging and caffeinate
log_message="$instance: Installomator 1st, v$scriptVersion"
label="1st-v$scriptVersion"
log_location="/private/var/log/Installomator.log"
printlog(){
timestamp=$(date +%F\ %T)
if [[ "$(whoami)" == "root" ]]; then
echo "$timestamp :: $label : $1" | tee -a $log_location
else
echo "$timestamp :: $label : $1"
fi
}
printlog "[LOG-BEGIN] ${log_message}"
# Internet check
if [[ "$(nc -z -v -G 10 1.1.1.1 53 2>&1 | grep -io "succeeded")" != "succeeded" ]]; then
printlog "ERROR. No internet connection, we cannot continue."
caffexit 90
fi
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid" || true
pkill caffeinate || true
printlog "[LOG-END] Status $1"
exit $1
}
# Counters
errorCount=0
countLabels=${#items[@]}
printlog "Total installations: $countLabels"
# Using LOGO variable to specify MDM and shown logo
case $LOGO in
appstore)
# Apple App Store on Mac
if [[ $(sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
;;
jamf)
# Jamf Pro
LOGO_PATH="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns"
;;
mosyleb)
# Mosyle Business
LOGO_PATH="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns"
;;
mosylem)
# Mosyle Manager (education)
LOGO_PATH="/Applications/Manager.app/Contents/Resources/AppIcon.icns"
;;
addigy)
# Addigy
LOGO_PATH="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns"
;;
microsoft)
# Microsoft Endpoint Manager (Intune)
LOGO_PATH="/Library/Intune/Microsoft Intune Agent.app/Contents/Resources/AppIcon.icns"
;;
ws1)
# Workspace ONE (AirWatch)
LOGO="/Applications/Workspace ONE Intelligent Hub.app/Contents/Resources/AppIcon.icns"
;;
esac
if [[ ! -a "${LOGO_PATH}" ]]; then
printlog "ERROR in LOGO_PATH '${LOGO_PATH}', setting Mac App Store."
if [[ $(/usr/bin/sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
fi
printlog "LOGO: $LOGO LOGO_PATH: $LOGO_PATH"
# Mark: Functions
# Notify the user using AppleScript
function displayDialog(){
currentUser="$(stat -f "%Su" /dev/console)"
currentUserID=$(id -u "$currentUser")
if [[ "$currentUser" != "" ]]; then
launchctl asuser $currentUserID sudo -u $currentUser osascript -e "button returned of (display dialog \"$message\" buttons {\"OK\"} default button \"OK\" with icon POSIX file \"$LOGO_PATH\")" || true
fi
}
# Mark: Code
name="Installomator"
printlog "$name check for installation"
# download URL, version and Expected Team ID
# Method for GitHub pkg
gitusername="Installomator"
gitreponame="Installomator"
#printlog "$gitusername $gitreponame"
filetype="pkg"
#downloadURL="https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
downloadURL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
if [[ "$(echo $downloadURL | grep -ioE "https.*.$filetype")" == "" ]]; then
printlog "Trying GitHub API for download URL."
downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")
fi
#printlog "$downloadURL"
appNewVersion=$(curl -sLI "https://github.com/$gitusername/$gitreponame/releases/latest" | grep -i "^location" | tr "/" "\n" | tail -1 | sed 's/[^0-9\.]//g')
#printlog "$appNewVersion"
expectedTeamID="JME5BW3F3R"
destFile="/usr/local/Installomator/Installomator.sh"
currentInstalledVersion="$(${destFile} version 2>/dev/null || true)"
printlog "${destFile} version: $currentInstalledVersion"
if [[ ! -e "${destFile}" || "$currentInstalledVersion" != "$appNewVersion" ]]; then
printlog "$name not found or version not latest."
printlog "${destFile}"
printlog "Installing version ${appNewVersion} ..."
# Create temporary working directory
tmpDir="$(mktemp -d || true)"
printlog "Created working directory '$tmpDir'"
# Download the installer package
printlog "Downloading $name package version $appNewVersion from: $downloadURL"
installationCount=0
exitCode=9
while [[ $installationCount -lt 3 && $exitCode -gt 0 ]]; do
curlDownload=$(curl -Ls "$downloadURL" -o "$tmpDir/$name.pkg" || true)
curlDownloadStatus=$(echo $?)
if [[ $curlDownloadStatus -ne 0 ]]; then
printlog "error downloading $downloadURL, with status $curlDownloadStatus"
printlog "${curlDownload}"
exitCode=1
else
printlog "Download $name succes."
# Verify the download
teamID=$(spctl -a -vv -t install "$tmpDir/$name.pkg" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' || true)
printlog "Team ID for downloaded package: $teamID"
# Install the package if Team ID validates
if [ "$expectedTeamID" = "$teamID" ] || [ "$expectedTeamID" = "" ]; then
printlog "$name package verified. Installing package '$tmpDir/$name.pkg'."
pkgInstall=$(installer -verbose -dumplog -pkg "$tmpDir/$name.pkg" -target "/" 2>&1)
pkgInstallStatus=$(echo $?)
if [[ $pkgInstallStatus -ne 0 ]]; then
printlog "ERROR. $name package installation failed."
printlog "${pkgInstall}"
exitCode=2
else
printlog "Installing $name package succes."
exitCode=0
fi
else
printlog "ERROR. Package verification failed for $name before package installation could start. Download link may be invalid."
exitCode=3
fi
fi
((installationCount++))
printlog "$installationCount time(s), exitCode $exitCode"
if [[ $installationCount -lt 3 ]]; then
if [[ $exitCode -gt 0 ]]; then
printlog "Sleep a bit before trying download and install again. $installationCount time(s)."
printlog "Remove $(rm -fv "$tmpDir/$name.pkg" || true)"
sleep 2
fi
else
printlog "Download and install of $name succes."
fi
done
# Remove the temporary working directory
printlog "Deleting working directory '$tmpDir' and its contents."
printlog "Remove $(rm -Rfv "${tmpDir}" || true)"
# Handle installation errors
if [[ $exitCode != 0 ]]; then
printlog "ERROR. Installation of $name failed. Aborting."
caffexit $exitCode
else
printlog "$name version $appNewVersion installed!"
fi
else
printlog "$name version $appNewVersion already found. Perfect!"
fi
errorLabels=""
((countLabels++))
((countLabels--))
printlog "$countLabels labels to install"
for item in "${items[@]}"; do
printlog "$item"
cmdOutput="$( ${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || true )"
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
printlog "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text "WARN" || true )"
printlog "$warnOutput"
else
printlog "Error installing ${item}. Exit code ${exitStatus}"
#printlog "$cmdOutput"
errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
printlog "$errorOutput"
((errorCount++))
errorLabels="$errorLabels ${item}"
fi
((countLabels--))
itemName=""
done
# Mark: Finishing
# Prevent re-run of script if conditionFile is set
if [[ ! -z "$conditionFile" ]]; then
printlog "Touching condition file so script will not run again"
touch "$conditionFile" || true
printlog "$(ls -al "$conditionFile" || true)"
fi
# Show error to user if any
printlog "Errors: $errorCount"
if [[ $errorCount -ne 0 ]]; then
printlog "ERROR: Display error dialog to user!"
errorMessage="${errorMessage} Total errors: $errorCount"
if [[ $showError -eq 1 ]]; then
message="$errorMessage"
displayDialog &
fi
printlog "errorLabels: $errorLabels"
fi
printlog "Ending"
caffexit $errorCount

View File

@@ -0,0 +1,360 @@
#!/bin/sh
# Installomator 1st installation with DEPNotify window (for self Service deployment)
instance="" # Name of used instance
LOGO="" # "appstore", "jamf", "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
items=(dialog dockutil microsoftautoupdate supportapp applenyfonts applesfpro applesfmono applesfcompact xink zohoworkdrivetruesync textmate 1password7 wwdc theunarchiver keka microsoftedge microsoftteams microsoftonedrive microsoftoffice365)
# Remember: dialog dockutil
installomatorOptions="NOTIFY=all BLOCKING_PROCESS_ACTION=prompt_user"
# DEPNotify display settings, change as desired
title="Installing Apps and other software"
message="Please wait while we download and install the needed software."
endMessage="Installation complete! Please reboot to activate FileVault."
errorMessage="A problem was encountered setting up this Mac. Please contact IT."
######################################################################
# Installomator 1st DEPNotify
#
# Installation using Installomator showing progress with DEPNotify
# Great stand-alone solution if installs are only done using Installomator.
# No customization below…
######################################################################
# This script can be used to install software using Installomator.
# Script will start DEPNotify to display a progress bar.
# Progress bar moves between installations
######################################################################
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
#
# This script made by Søren Theilgaard
# https://github.com/Theile
# Twitter and MacAdmins Slack: @theilgaard
#
# Some functions and code from Installomator:
# https://github.com/Installomator/Installomator
#
######################################################################
scriptVersion="9.5"
# v. 9.5 : 2022-09-21 : change of GitHub download
# v. 9.4 : 2022-09-14 : downloadURL can fall back on GitHub API
# v. 9.3 : 2022-08-29 : installomatorOptions in quotes and ignore blocking processes. Improved installation with looping if it fails, so it can try again. Improved GitHub handling. ws1 support.
# v. 9.2.2 : 2022-06-17 : installomatorOptions introduced. Check 1.1.1.1 for internet connection.
# v. 9.2.1 : 2022-05-30 : Some changes to logging
# v. 9.2 : 2022-05-19 : Built in installer for Installlomator, and display dialog if error happens. Now universal script for all supported MDMs based on LOGO variable.
# v. 9.1 : 2022-04-13 : Using INSTALL=force in Label only, so Microsoft labels will not start updating
# v. 9.0.1 : 2022-02-21 : LOGO=addigy, few more "true" lines, and errorOutput on error
# v. 9.0.0 : 2022-02-14 : Updated for Inst. 9.0, Logging improved with printlog
######################################################################
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Check before running
case $LOGO in
addigy|microsoft)
conditionFile="/var/db/.Installomator1stDone"
# Addigy and Microsoft Endpoint Manager (Intune) need a check for a touched file
if [ -e "$conditionFile" ]; then
echo "$LOGO setup detected"
echo "$conditionFile exists, so we exit."
exit 0
else
echo "$conditionFile not found, so we continue…"
fi
;;
esac
# Mark: Constants, logging and caffeinate
log_message="$instance: Installomator 1st with DEPNotify, v$scriptVersion"
label="1st-v$scriptVersion"
log_location="/private/var/log/Installomator.log"
printlog(){
timestamp=$(date +%F\ %T)
if [[ "$(whoami)" == "root" ]]; then
echo "$timestamp :: $label : $1" | tee -a $log_location
else
echo "$timestamp :: $label : $1"
fi
}
printlog "[LOG-BEGIN] ${log_message}"
# Internet check
if [[ "$(nc -z -v -G 10 1.1.1.1 53 2>&1 | grep -io "succeeded")" != "succeeded" ]]; then
printlog "ERROR. No internet connection, we cannot continue."
exit 90
fi
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid" || true
pkill caffeinate || true
printlog "[LOG-END] Status $1"
exit $1
}
# Command-file to DEPNotify
DEPNOTIFY_LOG="/var/tmp/depnotify.log"
# Counters
errorCount=0
countLabels=${#items[@]}
printlog "Total installations: $countLabels"
# Using LOGO variable to specify MDM and shown logo
case $LOGO in
appstore)
# Apple App Store on Mac
if [[ $(sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
;;
jamf)
# Jamf Pro
LOGO_PATH="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns"
;;
mosyleb)
# Mosyle Business
LOGO_PATH="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns"
;;
mosylem)
# Mosyle Manager (education)
LOGO_PATH="/Applications/Manager.app/Contents/Resources/AppIcon.icns"
;;
addigy)
# Addigy
LOGO_PATH="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns"
;;
microsoft)
# Microsoft Endpoint Manager (Intune)
LOGO_PATH="/Library/Intune/Microsoft Intune Agent.app/Contents/Resources/AppIcon.icns"
;;
ws1)
# Workspace ONE (AirWatch)
LOGO="/Applications/Workspace ONE Intelligent Hub.app/Contents/Resources/AppIcon.icns"
;;
esac
if [[ ! -a "${LOGO_PATH}" ]]; then
printlog "ERROR in LOGO_PATH '${LOGO_PATH}', setting Mac App Store."
if [[ $(/usr/bin/sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
fi
printlog "LOGO: $LOGO - LOGO_PATH: $LOGO_PATH"
# Mark: Functions
printlog "depnotify_command function"
echo "" > $DEPNOTIFY_LOG || true
function depnotify_command(){
printlog "DEPNotify-command: $1"
echo "$1" >> $DEPNOTIFY_LOG || true
}
printlog "startDEPNotify function"
function startDEPNotify() {
currentUser="$(stat -f "%Su" /dev/console)"
currentUserID=$(id -u "$currentUser")
launchctl asuser $currentUserID open -a "/Applications/Utilities/DEPNotify.app/Contents/MacOS/DEPNotify" --args -path "$DEPNOTIFY_LOG" || true # --args -fullScreen
sleep 5
depnotify_command "Command: KillCommandFile:"
depnotify_command "Command: MainTitle: $title"
depnotify_command "Command: Image: $LOGO_PATH"
depnotify_command "Command: MainText: $message"
depnotify_command "Command: Determinate: $countLabels"
}
# Notify the user using AppleScript
printlog "displayDialog function"
function displayDialog(){
currentUser="$(stat -f "%Su" /dev/console)"
currentUserID=$(id -u "$currentUser")
if [[ "$currentUser" != "" ]]; then
launchctl asuser $currentUserID sudo -u $currentUser osascript -e "button returned of (display dialog \"$message\" buttons {\"OK\"} default button \"OK\" with icon POSIX file \"$LOGO_PATH\")" || true
fi
}
# Mark: Code
name="Installomator"
printlog "$name check for installation"
# download URL, version and Expected Team ID
# Method for GitHub pkg
gitusername="Installomator"
gitreponame="Installomator"
#printlog "$gitusername $gitreponame"
filetype="pkg"
#downloadURL="https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
downloadURL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
if [[ "$(echo $downloadURL | grep -ioE "https.*.$filetype")" == "" ]]; then
printlog "Trying GitHub API for download URL."
downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")
fi
#printlog "$downloadURL"
appNewVersion=$(curl -sLI "https://github.com/$gitusername/$gitreponame/releases/latest" | grep -i "^location" | tr "/" "\n" | tail -1 | sed 's/[^0-9\.]//g')
#printlog "$appNewVersion"
expectedTeamID="JME5BW3F3R"
destFile="/usr/local/Installomator/Installomator.sh"
currentInstalledVersion="$(${destFile} version 2>/dev/null || true)"
printlog "${destFile} version: $currentInstalledVersion"
if [[ ! -e "${destFile}" || "$currentInstalledVersion" != "$appNewVersion" ]]; then
printlog "$name not found or version not latest."
printlog "${destFile}"
printlog "Installing version ${appNewVersion} ..."
# Create temporary working directory
tmpDir="$(mktemp -d || true)"
printlog "Created working directory '$tmpDir'"
# Download the installer package
printlog "Downloading $name package version $appNewVersion from: $downloadURL"
installationCount=0
exitCode=9
while [[ $installationCount -lt 3 && $exitCode -gt 0 ]]; do
curlDownload=$(curl -Ls "$downloadURL" -o "$tmpDir/$name.pkg" || true)
curlDownloadStatus=$(echo $?)
if [[ $curlDownloadStatus -ne 0 ]]; then
printlog "error downloading $downloadURL, with status $curlDownloadStatus"
printlog "${curlDownload}"
exitCode=1
else
printlog "Download $name succes."
# Verify the download
teamID=$(spctl -a -vv -t install "$tmpDir/$name.pkg" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' || true)
printlog "Team ID for downloaded package: $teamID"
# Install the package if Team ID validates
if [ "$expectedTeamID" = "$teamID" ] || [ "$expectedTeamID" = "" ]; then
printlog "$name package verified. Installing package '$tmpDir/$name.pkg'."
pkgInstall=$(installer -verbose -dumplog -pkg "$tmpDir/$name.pkg" -target "/" 2>&1)
pkgInstallStatus=$(echo $?)
if [[ $pkgInstallStatus -ne 0 ]]; then
printlog "ERROR. $name package installation failed."
printlog "${pkgInstall}"
exitCode=2
else
printlog "Installing $name package succes."
exitCode=0
fi
else
printlog "ERROR. Package verification failed for $name before package installation could start. Download link may be invalid."
exitCode=3
fi
fi
((installationCount++))
printlog "$installationCount time(s), exitCode $exitCode"
if [[ $installationCount -lt 3 ]]; then
if [[ $exitCode -gt 0 ]]; then
printlog "Sleep a bit before trying download and install again. $installationCount time(s)."
printlog "Remove $(rm -fv "$tmpDir/$name.pkg" || true)"
sleep 2
fi
else
printlog "Download and install of $name succes."
fi
done
# Remove the temporary working directory
printlog "Deleting working directory '$tmpDir' and its contents."
printlog "Remove $(rm -Rfv "${tmpDir}" || true)"
# Handle installation errors
if [[ $exitCode != 0 ]]; then
printlog "ERROR. Installation of $name failed. Aborting."
caffexit $exitCode
else
printlog "$name version $appNewVersion installed!"
fi
else
printlog "$name version $appNewVersion already found. Perfect!"
fi
# Installing DEPNotify
cmdOutput="$( ${destFile} depnotify LOGO=$LOGO NOTIFY=silent BLOCKING_PROCESS_ACTION=ignore LOGGING=WARN || true )"
exitStatus="$( echo "${cmdOutput}" | grep --binary-files=text -i "exit" | tail -1 | sed -E 's/.*exit code ([0-9]).*/\1/g' || true )"
printlog "DEPNotify install result: $exitStatus"
itemName=""
errorLabels=""
((countLabels++))
((countLabels--))
printlog "$countLabels labels to install"
startDEPNotify
for item in "${items[@]}"; do
# Check if DEPNotify is running and try open it if not
if ! pgrep -xq "DEPNotify"; then
startDEPNotify
fi
itemName=$( ${destFile} ${item} RETURN_LABEL_NAME=1 LOGGING=REQ INSTALL=force | tail -1 || true )
if [[ "$itemName" != "#" ]]; then
depnotify_command "Status: $itemName installing…"
else
depnotify_command "Status: $item installing…"
fi
printlog "$item $itemName"
cmdOutput="$( ${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || true )"
#cmdOutput="2022-05-19 13:20:45 : REQ : installomator : ################## End Installomator, exit code 0"
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
printlog "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text "WARN" || true )"
printlog "$warnOutput"
else
printlog "Error installing ${item}. Exit code ${exitStatus}"
#printlog "$cmdOutput"
errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
printlog "$errorOutput"
((errorCount++))
errorLabels="$errorLabels ${item}"
fi
((countLabels--))
itemName=""
done
# Mark: Finishing
# Prevent re-run of script if conditionFile is set
if [[ ! -z "$conditionFile" ]]; then
printlog "Touching condition file so script will not run again"
touch "$conditionFile" || true
printlog "$(ls -al "$conditionFile" || true)"
fi
# Show error to user if any
printlog "Errors: $errorCount"
if [[ $errorCount -ne 0 ]]; then
errorMessage="${errorMessage} Total errors: $errorCount"
message="$errorMessage"
displayDialog &
endMessage="$message"
printlog "errorLabels: $errorLabels"
fi
depnotify_command "Command: MainText: $endMessage"
depnotify_command "Command: Quit: $endMessage"
sleep 1
printlog "Remove $(rm -fv $DEPNOTIFY_LOG || true)"
printlog "Ending"
caffexit $errorCount

307
MDM/Installomator 1st SS.sh Executable file
View File

@@ -0,0 +1,307 @@
#!/bin/sh
# Installomator 1st installation (for Self Service deployment)
instance="" # Name of used instance
LOGO="" # "appstore", "jamf", "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
items=(dialog dockutil microsoftautoupdate supportapp applenyfonts applesfpro applesfmono applesfcompact xink zohoworkdrivetruesync textmate 1password7 wwdc theunarchiver keka microsoftedge microsoftteams microsoftonedrive microsoftoffice365)
# Remember: dialog dockutil
installomatorOptions="NOTIFY=all BLOCKING_PROCESS_ACTION=prompt_user"
# Error message to user if any occur
showError="1" # Show error message if 1 (0 if it should not be shown)
errorMessage="A problem was encountered setting up this Mac. Please contact IT."
######################################################################
# Installomator 1st for Self Service
#
# Installation using Installomator
# No customization below…
######################################################################
# This script can be used to install software using Installomator, where the user activate it in Self Service.
# Script will display a dialog if any errors happens.
# Progress is shown in notifications to the user
######################################################################
# Other installomatorOptions:
# LOGGING=REQ
# LOGGING=DEBUG
# LOGGING=WARN
# BLOCKING_PROCESS_ACTION=ignore
# BLOCKING_PROCESS_ACTION=tell_user
# BLOCKING_PROCESS_ACTION=tell_user_then_quit
# BLOCKING_PROCESS_ACTION=prompt_user
# BLOCKING_PROCESS_ACTION=prompt_user_loop
# BLOCKING_PROCESS_ACTION=prompt_user_then_kill
# BLOCKING_PROCESS_ACTION=quit
# BLOCKING_PROCESS_ACTION=kill
# NOTIFY=all
# NOTIFY=success
# NOTIFY=silent
# IGNORE_APP_STORE_APPS=yes
# INSTALL=force
######################################################################
#
# This script made by Søren Theilgaard
# https://github.com/Theile
# Twitter and MacAdmins Slack: @theilgaard
#
# Some functions and code from Installomator:
# https://github.com/Installomator/Installomator
#
######################################################################
scriptVersion="9.5"
# v. 9.5 : 2022-09-21 : change of GitHub download
# v. 9.4 : 2022-09-14 : Making error message optional. downloadURL can fall back on GitHub API.
# v. 9.3 : 2022-08-29 : installomatorOptions in quotes and ignore blocking processes. Improved installation with looping if it fails, so it can try again. Improved GitHub handling. ws1 support.
# v. 9.2.2 : 2022-06-17 : installomatorOptions introduced. Check 1.1.1.1 for internet connection.
# v. 9.2.1 : 2022-05-30 : Some changes to logging
# v. 9.2 : 2022-05-19 : Built in installer for Installomator, and display dialog if error happens. Now universal script for all supported MDMs based on LOGO variable.
######################################################################
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Check before running
case $LOGO in
addigy|microsoft)
conditionFile="/var/db/.Installomator1stDone"
# Addigy and Microsoft Endpoint Manager (Intune) need a check for a touched file
if [ -e "$conditionFile" ]; then
echo "$LOGO setup detected"
echo "$conditionFile exists, so we exit."
exit 0
else
echo "$conditionFile not found, so we continue…"
fi
;;
esac
# Mark: Constants, logging and caffeinate
log_message="$instance: Installomator 1st, v$scriptVersion"
label="1st-v$scriptVersion"
log_location="/private/var/log/Installomator.log"
printlog(){
timestamp=$(date +%F\ %T)
if [[ "$(whoami)" == "root" ]]; then
echo "$timestamp :: $label : $1" | tee -a $log_location
else
echo "$timestamp :: $label : $1"
fi
}
printlog "[LOG-BEGIN] ${log_message}"
# Internet check
if [[ "$(nc -z -v -G 10 1.1.1.1 53 2>&1 | grep -io "succeeded")" != "succeeded" ]]; then
printlog "ERROR. No internet connection, we cannot continue."
caffexit 90
fi
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid" || true
pkill caffeinate || true
printlog "[LOG-END] Status $1"
exit $1
}
# Counters
errorCount=0
countLabels=${#items[@]}
printlog "Total installations: $countLabels"
# Using LOGO variable to specify MDM and shown logo
case $LOGO in
appstore)
# Apple App Store on Mac
if [[ $(sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
;;
jamf)
# Jamf Pro
LOGO_PATH="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns"
;;
mosyleb)
# Mosyle Business
LOGO_PATH="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns"
;;
mosylem)
# Mosyle Manager (education)
LOGO_PATH="/Applications/Manager.app/Contents/Resources/AppIcon.icns"
;;
addigy)
# Addigy
LOGO_PATH="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns"
;;
microsoft)
# Microsoft Endpoint Manager (Intune)
LOGO_PATH="/Library/Intune/Microsoft Intune Agent.app/Contents/Resources/AppIcon.icns"
;;
ws1)
# Workspace ONE (AirWatch)
LOGO="/Applications/Workspace ONE Intelligent Hub.app/Contents/Resources/AppIcon.icns"
;;
esac
if [[ ! -a "${LOGO_PATH}" ]]; then
printlog "ERROR in LOGO_PATH '${LOGO_PATH}', setting Mac App Store."
if [[ $(/usr/bin/sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
fi
printlog "LOGO: $LOGO LOGO_PATH: $LOGO_PATH"
# Mark: Functions
# Notify the user using AppleScript
function displayDialog(){
currentUser="$(stat -f "%Su" /dev/console)"
currentUserID=$(id -u "$currentUser")
if [[ "$currentUser" != "" ]]; then
launchctl asuser $currentUserID sudo -u $currentUser osascript -e "button returned of (display dialog \"$message\" buttons {\"OK\"} default button \"OK\" with icon POSIX file \"$LOGO_PATH\")" || true
fi
}
# Mark: Code
name="Installomator"
printlog "$name check for installation"
# download URL, version and Expected Team ID
# Method for GitHub pkg
gitusername="Installomator"
gitreponame="Installomator"
#printlog "$gitusername $gitreponame"
filetype="pkg"
#downloadURL="https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
downloadURL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
if [[ "$(echo $downloadURL | grep -ioE "https.*.$filetype")" == "" ]]; then
printlog "Trying GitHub API for download URL."
downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")
fi
#printlog "$downloadURL"
appNewVersion=$(curl -sLI "https://github.com/$gitusername/$gitreponame/releases/latest" | grep -i "^location" | tr "/" "\n" | tail -1 | sed 's/[^0-9\.]//g')
#printlog "$appNewVersion"
expectedTeamID="JME5BW3F3R"
destFile="/usr/local/Installomator/Installomator.sh"
currentInstalledVersion="$(${destFile} version 2>/dev/null || true)"
printlog "${destFile} version: $currentInstalledVersion"
if [[ ! -e "${destFile}" || "$currentInstalledVersion" != "$appNewVersion" ]]; then
printlog "$name not found or version not latest."
printlog "${destFile}"
printlog "Installing version ${appNewVersion} ..."
# Create temporary working directory
tmpDir="$(mktemp -d || true)"
printlog "Created working directory '$tmpDir'"
# Download the installer package
printlog "Downloading $name package version $appNewVersion from: $downloadURL"
installationCount=0
exitCode=9
while [[ $installationCount -lt 3 && $exitCode -gt 0 ]]; do
curlDownload=$(curl -Ls "$downloadURL" -o "$tmpDir/$name.pkg" || true)
curlDownloadStatus=$(echo $?)
if [[ $curlDownloadStatus -ne 0 ]]; then
printlog "error downloading $downloadURL, with status $curlDownloadStatus"
printlog "${curlDownload}"
exitCode=1
else
printlog "Download $name succes."
# Verify the download
teamID=$(spctl -a -vv -t install "$tmpDir/$name.pkg" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' || true)
printlog "Team ID for downloaded package: $teamID"
# Install the package if Team ID validates
if [ "$expectedTeamID" = "$teamID" ] || [ "$expectedTeamID" = "" ]; then
printlog "$name package verified. Installing package '$tmpDir/$name.pkg'."
pkgInstall=$(installer -verbose -dumplog -pkg "$tmpDir/$name.pkg" -target "/" 2>&1)
pkgInstallStatus=$(echo $?)
if [[ $pkgInstallStatus -ne 0 ]]; then
printlog "ERROR. $name package installation failed."
printlog "${pkgInstall}"
exitCode=2
else
printlog "Installing $name package succes."
exitCode=0
fi
else
printlog "ERROR. Package verification failed for $name before package installation could start. Download link may be invalid."
exitCode=3
fi
fi
((installationCount++))
printlog "$installationCount time(s), exitCode $exitCode"
if [[ $installationCount -lt 3 ]]; then
if [[ $exitCode -gt 0 ]]; then
printlog "Sleep a bit before trying download and install again. $installationCount time(s)."
printlog "Remove $(rm -fv "$tmpDir/$name.pkg" || true)"
sleep 2
fi
else
printlog "Download and install of $name succes."
fi
done
# Remove the temporary working directory
printlog "Deleting working directory '$tmpDir' and its contents."
printlog "Remove $(rm -Rfv "${tmpDir}" || true)"
# Handle installation errors
if [[ $exitCode != 0 ]]; then
printlog "ERROR. Installation of $name failed. Aborting."
caffexit $exitCode
else
printlog "$name version $appNewVersion installed!"
fi
else
printlog "$name version $appNewVersion already found. Perfect!"
fi
errorLabels=""
((countLabels++))
((countLabels--))
printlog "$countLabels labels to install"
for item in "${items[@]}"; do
printlog "$item"
cmdOutput="$( ${destFile} ${item} LOGO=$LOGO ${installomatorOptions} || true )"
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
printlog "${item} succesfully installed."
warnOutput="$( echo "${cmdOutput}" | grep --binary-files=text "WARN" || true )"
printlog "$warnOutput"
else
printlog "Error installing ${item}. Exit code ${exitStatus}"
#printlog "$cmdOutput"
errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
printlog "$errorOutput"
((errorCount++))
errorLabels="$errorLabels ${item}"
fi
((countLabels--))
itemName=""
done
# Mark: Finishing
# Prevent re-run of script if conditionFile is set
if [[ ! -z "$conditionFile" ]]; then
printlog "Touching condition file so script will not run again"
touch "$conditionFile" || true
printlog "$(ls -al "$conditionFile" || true)"
fi
# Show error to user if any
printlog "Errors: $errorCount"
if [[ $errorCount -ne 0 ]]; then
printlog "ERROR: Display error dialog to user!"
errorMessage="${errorMessage} Total errors: $errorCount"
if [[ $showError -eq 1 ]]; then
message="$errorMessage"
displayDialog &
fi
printlog "errorLabels: $errorLabels"
fi
printlog "Ending"
caffexit $errorCount

View File

@@ -0,0 +1,13 @@
#!/bin/sh
# Mark: Addigy Condition on condition file
# Install on success
conditionFile="/var/db/.Installomator1stDone"
if [ -e "$conditionFile" ]; then
echo "$conditionFile exists. Exiting."
exit 1
else
echo "$conditionFile not found. Continue…"
exit 0
fi

View File

@@ -0,0 +1,11 @@
#!/bin/sh
# PREVENT Installomator 1st Auto-install from running
# DESCRIPTION
# Will create the file to prevent Installomator 1st Auto-install from running.
# Only for MDM solutions (like Addigy and Microsoft) that have conditions for runnning scripts and do not offer an enrollment event for runnning the script.
# By runninng this script, the file will be created on the client, that will prevent Installomator 1st Auto-install from runnning.
# This is a great help for implementing Installomator 1st Auto-install in a running solution, where the command below have to be run on currently enrolled devices, and then Installomator 1st Auto-install can be assigned to all machines, and will run only on newly enrolled devices.
/usr/bin/touch "/var/db/.Installomator1stDone"

View File

@@ -1,42 +0,0 @@
#!/bin/bash
# Updating Installomator
# Usefull to push out after deployment if earlier version was deployed in DEP profile
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 &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Install software using Installomator
cmdOutput="$(${destFile} ${what} LOGO=$LOGO BLOCKING_PROCESS_ACTION=ignore NOTIFY=silent LOGGING=req || 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} -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]"
caffexit 0

View File

@@ -0,0 +1,160 @@
#!/bin/zsh
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# MARK: Arguments/Parameters
# Parameter 4: path to the swiftDialog command file
dialog_command_file=${4:-"/var/tmp/dialog.log"}
# Parameter 5: message displayed over the progress bar
message=${5:-"Self Service Progress"}
# Parameter 6: path or URL to an icon
icon=${6:-"/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"}
# see Dan Snelson's advice on how to get a URL to an icon in Self Service
# https://rumble.com/v119x6y-harvesting-self-service-icons.html
# MARK: Constants
dialogApp="/Library/Application Support/Dialog/Dialog.app"
# MARK: Functions
dialogUpdate() {
# $1: dialog command
local dcommand="$1"
if [[ -n $dialog_command_file ]]; then
echo "$dcommand" >> "$dialog_command_file"
echo "Dialog: $dcommand"
fi
}
# MARK: sanity checks
# check minimal macOS requirement
if [[ $(sw_vers -buildVersion ) < "20A" ]]; then
echo "This script requires at least macOS 11 Big Sur."
exit 98
fi
# check we are running as root
if [[ $DEBUG -eq 0 && $(id -u) -ne 0 ]]; then
echo "This script should be run as root"
exit 97
fi
# swiftDialog installation
name="Dialog"
echo "$name check for installation"
# download URL, version and Expected Team ID
# Method for GitHub pkg w. app version check
gitusername="bartreardon"
gitreponame="swiftDialog"
#echo "$gitusername $gitreponame"
filetype="pkg"
#downloadURL="https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
downloadURL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
if [[ "$(echo $downloadURL | grep -ioE "https.*.$filetype")" == "" ]]; then
echo "Trying GitHub API for download URL."
downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")
fi
#echo "$downloadURL"
appNewVersion=$(curl -sLI "https://github.com/$gitusername/$gitreponame/releases/latest" | grep -i "^location" | tr "/" "\n" | tail -1 | sed 's/[^0-9\.]//g')
#echo "$appNewVersion"
expectedTeamID="PWA5E9TQ59"
destFile="/Library/Application Support/Dialog/Dialog.app"
versionKey="CFBundleShortVersionString" #CFBundleVersion
currentInstalledVersion="$(defaults read "${destFile}/Contents/Info.plist" $versionKey || true)"
echo "${name} version: $currentInstalledVersion"
if [[ ! -e "${destFile}" || "$currentInstalledVersion" != "$appNewVersion" ]]; then
echo "$name not found or version not latest."
echo "${destFile}"
echo "Installing version ${appNewVersion}"
# Create temporary working directory
tmpDir="$(mktemp -d || true)"
echo "Created working directory '$tmpDir'"
# Download the installer package
echo "Downloading $name package version $appNewVersion from: $downloadURL"
installationCount=0
exitCode=9
while [[ $installationCount -lt 3 && $exitCode -gt 0 ]]; do
curlDownload=$(curl -Ls "$downloadURL" -o "$tmpDir/$name.pkg" || true)
curlDownloadStatus=$(echo $?)
if [[ $curlDownloadStatus -ne 0 ]]; then
echo "error downloading $downloadURL, with status $curlDownloadStatus"
echo "${curlDownload}"
exitCode=1
else
echo "Download $name succes."
# Verify the download
teamID=$(spctl -a -vv -t install "$tmpDir/$name.pkg" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' || true)
echo "Team ID for downloaded package: $teamID"
# Install the package if Team ID validates
if [ "$expectedTeamID" = "$teamID" ] || [ "$expectedTeamID" = "" ]; then
echo "$name package verified. Installing package '$tmpDir/$name.pkg'."
pkgInstall=$(installer -verbose -dumplog -pkg "$tmpDir/$name.pkg" -target "/" 2>&1)
pkgInstallStatus=$(echo $?)
if [[ $pkgInstallStatus -ne 0 ]]; then
echo "ERROR. $name package installation failed."
echo "${pkgInstall}"
exitCode=2
else
echo "Installing $name package succes."
exitCode=0
fi
else
echo "ERROR. Package verification failed for $name before package installation could start. Download link may be invalid."
exitCode=3
fi
fi
((installationCount++))
echo "$installationCount time(s), exitCode $exitCode"
if [[ $installationCount -lt 3 ]]; then
if [[ $exitCode -gt 0 ]]; then
echo "Sleep a bit before trying download and install again. $installationCount time(s)."
echo "Remove $(rm -fv "$tmpDir/$name.pkg" || true)"
sleep 2
fi
else
echo "Download and install of $name succes."
fi
done
# Remove the temporary working directory
echo "Deleting working directory '$tmpDir' and its contents."
echo "Remove $(rm -Rfv "${tmpDir}" || true)"
# Handle installation errors
if [[ $exitCode != 0 ]]; then
echo "ERROR. Installation of $name failed. Aborting."
caffexit $exitCode
else
echo "$name version $appNewVersion installed!"
fi
else
echo "$name version $appNewVersion already found. Perfect!"
fi
# check for Swift Dialog
if [[ ! -d $dialogApp ]]; then
echo "Cannot find dialog at $dialogApp"
exit 95
fi
# MARK: Configure and display swiftDialog
# display first screen
open -a "$dialogApp" --args \
--title none \
--icon "$icon" \
--message "$message" \
--mini \
--progress 100 \
--position bottomright \
--movable \
--commandfile "$dialog_command_file"
# give everything a moment to catch up
sleep 0.1

View File

@@ -0,0 +1,69 @@
#!/bin/zsh
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# MARK: Arguments/Parameters
# Parameter 4: path to the swiftDialog command file
dialog_command_file=${4:-"/var/tmp/dialog.log"}
# Parameter 5: message displayed over the progress bar
message=${5:-"Self Service Progress"}
# Parameter 6: path or URL to an icon
icon=${6:-"/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"}
# see Dan Snelson's advice on how to get a URL to an icon in Self Service
# https://rumble.com/v119x6y-harvesting-self-service-icons.html
# MARK: Constants
dialogApp="/Library/Application Support/Dialog/Dialog.app"
# MARK: Functions
dialogUpdate() {
# $1: dialog command
local dcommand="$1"
if [[ -n $dialog_command_file ]]; then
echo "$dcommand" >> "$dialog_command_file"
echo "Dialog: $dcommand"
fi
}
# MARK: sanity checks
# check minimal macOS requirement
if [[ $(sw_vers -buildVersion ) < "20A" ]]; then
echo "This script requires at least macOS 11 Big Sur."
exit 98
fi
# check we are running as root
if [[ $DEBUG -eq 0 && $(id -u) -ne 0 ]]; then
echo "This script should be run as root"
exit 97
fi
# check for Swift Dialog
if [[ ! -d $dialogApp ]]; then
echo "Cannot find dialog at $dialogApp"
exit 95
fi
# MARK: Configure and display swiftDialog
# display first screen
open -a "$dialogApp" --args \
--title none \
--icon "$icon" \
--message "$message" \
--mini \
--progress 100 \
--position bottomright \
--movable \
--commandfile "$dialog_command_file"
# give everything a moment to catch up
sleep 0.1

48
MDM/Jamf/ReadMe.md Normal file
View File

@@ -0,0 +1,48 @@
# Display Installomator Progress with SwiftDialog in Jamf
Installomator 10 has functionality to communicate with [Bart Reardon's swiftDialog](https://github.com/bartreardon/swiftDialog). When you set the `DIALOG_CMD_FILE` variable Installomator will write progress for downloads and installation (with pkgs) to the command file which allows swiftDialog to display the progress.
However, you have to launch and setup swiftDialog to display a window with a progress bar before Installomator launches and also make sure swiftDialog quits after Installomator has run. This may seem complex at first but allows to configure swiftDialog just for your case without needing to modify the Installomator script.
Here are some example script that would run before and after Installomator to display a swiftDialog window and quit the process after. Since Jamf Pro executes scripts in alphanumerical order, the names are chosen accordingly, to ensure proper order.
## Setup in Jamf Pro
To show Installomator progress with swiftDialog from a Jamf Policy, you require three scripts:
- `00_Prepare_SwiftDialog.sh`: Configures and displays the swiftDialog window
- `Installomator.sh`: (v10 or higher)
- `zz_Quit_SwiftDialog.sh`: quits swiftDialog
Add these three scripts to your Jamf Pro and create a policy with these three scripts. The names are chosen that the script appear in the correct order. If you rename the scripts in Jamf Pro, this may disrupt the order and the workflow will not work anymore. The "Priority" of the scripts in the policy should all be the same value.
The different scripts require a set of parameters. We will use the `googlechromepkg` label as an example.
`00_Prepare_SwiftDialog.sh`
Parameter 4: `/var/tmp/dialog.log` (Path to the swiftDialog command file)
Parameter 5: `Installing Google Chrome...` (text shown in the swiftDialog window above the progress bar)
Parameter 6: Path to or URL for an icon in swiftDialog. This can be a path on the client or a URL. See Dan Snelson's advice on how to get icon URLs for Self Service icons: https://rumble.com/v119x6y-harvesting-self-service-icons.html
`Installomator.sh`
Parameter 4: `googlechromepkg` (the label to install)
Parameter 5: `DIALOG_CMD_FILE=/var/tmp/dialog.log` (the swiftDialog command file, this has to be the same value as parameter 4 in the previous script)
Parameter 6: `NOTIFY=silent` (disable Installomator notifications, optional)
You can add more configurations to the Installomator script when needed.
`zz_Quit_SwiftDialog`
Parameter 4: `/var/tmp/dialog.log` (the swiftDialog command file, this has to be the same value as parameter 4 in the first script)
Then setup the remainder of the Jamf Policy to your needs. This works best with Self Service policies.
When you run the policy, the first script will configure and display swiftDialog. Installomator.sh will download and install the app while writing the proper update commands to the file set in `DIALOG_CMD_FILE`. The final script will quit swiftDialog.
![](SelfServiceProgress.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 KiB

57
MDM/Jamf/zz_Quit_SwiftDialog.sh Executable file
View File

@@ -0,0 +1,57 @@
#!/bin/zsh
# MARK: Arguments/Parameters
# Parameter 4: path to the swiftDialog command file
dialog_command_file=${4:-"/var/tmp/dialog.log"}
# MARK: Constants
dialogApp="/Library/Application Support/Dialog/Dialog.app"
dialogUpdate() {
# $1: dialog command
local dcommand="$1"
if [[ -n $dialog_command_file ]]; then
echo "$dcommand" >> "$dialog_command_file"
echo "Dialog: $dcommand"
fi
}
# check minimal macOS requirement
if [[ $(sw_vers -buildVersion ) < "20A" ]]; then
echo "This script requires at least macOS 11 Big Sur."
exit 98
fi
# check we are running as root
if [[ $DEBUG -eq 0 && $(id -u) -ne 0 ]]; then
echo "This script should be run as root"
exit 97
fi
# check for Swift Dialog
if [[ ! -d $dialogApp ]]; then
echo "Cannot find dialog at $dialogApp"
exit 95
fi
# close and quit dialog
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"
# pause a moment
sleep 0.5
dialogUpdate "quit:"
# let everything catch up
sleep 0.5
# just to be safe
killall "Dialog"
# the killall command above will return error when Dialog is already quit
# but we don't want that to register as a failure in Jamf, so always exit 0
exit 0

View File

@@ -1,115 +0,0 @@
#!/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 (9.1.0)/Installomator-9.1.pkg" -target /
# Installation using Installomator
whatList="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 "whatList" above with labels separated by space " ".
# Script will loop through these labels and exit with number of errors.
######################################################################
# 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=quit_kill INSTALL=force IGNORE_APP_STORE_APPS=yes"
######################################################################
# 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=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Count errors
errorCount=0
for what in $whatList; do
#echo $what
# Install software using Installomator
cmdOutput="$(${destFile} ${what} LOGO=addigy $parameters || 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"
let errorCount++
fi
done
echo
echo "Errors: $errorCount"
echo "[$(DATE)][LOG-END]"
caffexit $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="9.1"
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

View File

@@ -1,79 +0,0 @@
PKG_ID="com.scriptingosx.Installomator"
TARGET_VERSION="9.1"
URLDOWNLOAD="%MosyleCDNFile:blah-blah-blah%"
######################################################################
# Installation using Installomator (enter the software to install separated with spaces in the "whatList"-variable)
whatList="handbrake theunarchiver microsoftoffice365"
# 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: Condition for Installomator installation
INSTALLED_VERSION="$(pkgutil --pkg-info $PKG_ID 2>/dev/null | grep -i "^version" | awk '{print $2}')"
echo "Current Version: ${INSTALLED_VERSION}"
if [[ "$TARGET_VERSION" != "$INSTALLED_VERSION" ]]; then
TMPDIR=$(mktemp -d )
if ! cd "$TMPDIR"; then
echo "error changing directory $TMPDIR"
caffexit 98
fi
NAME=$TMPDIR/$(date +%s).pkg
if ! curl -fsL "$URLDOWNLOAD" -o "$NAME"; then
echo "error downloading $URLDOWNLOAD to $NAME."
caffexit 97
fi
installer -pkg "$NAME" -target /
rm -rf "$TMPDIR"
else
echo "Installomator version $INSTALLED_VERSION already installed!"
fi
# 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
echo "Installomator not found here:"
echo "${destFile}"
echo "Exiting."
caffexit 99
fi
for what in $whatList; do
#echo $item
# Install software using Installomator
cmdOutput="$(${destFile} ${what} LOGO=$LOGO NOTIFY=all BLOCKING_PROCESS_ACTION=tell_user || 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

View File

@@ -1,56 +0,0 @@
#!/bin/bash
# Software
# Installation using Installomator
# Example of installing software using valuesfromarguments to install a custom software
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 &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid"
pkill caffeinate
exit $1
}
# Variables to calculate
downloadURL="https://craft-assets.invisionapp.com/CraftManager/production/CraftManager.zip"
appNewVersion=$(curl -fs https://craft-assets.invisionapp.com/CraftManager/production/appcast.xml | xpath -e '//rss/channel/item[1]/enclosure/@sparkle:shortVersionString' 2>/dev/null | cut -d '"' -f2)
# Install software using Installomator
cmdOutput="$(${destFile} valuesfromarguments LOGO=$LOGO \
name=CraftManager \
type=zip \
downloadURL=$downloadURL \
appNewVersion=$appNewVersion \
expectedTeamID=VRXQSNCL5W \
BLOCKING_PROCESS_ACTION=prompt_user \
LOGGING=REQ \
NOTIFY=all || 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} -eq 0 ]] ; then
echo -e "${what} succesfully installed.\n"
else
echo -e "Error installing ${what}. Exit code ${exitStatus}\n"
#printlog "$cmdOutput"
errorOutput="$( echo "${cmdOutput}" | grep --binary-files=text -i "error" || true )"
echo "$errorOutput"
caffexit $exitStatus
fi
echo "[$(DATE)][LOG-END]"
caffexit 0

View File

@@ -0,0 +1,13 @@
#!/bin/sh
# Mark: Addigy Condition on condition file
# Install on success
conditionFile="/var/db/.Progress1stDone"
if [ -e "$conditionFile" ]; then
echo "$conditionFile exists. Exiting."
exit 1
else
echo "$conditionFile not found. Continue…"
exit 0
fi

View File

@@ -0,0 +1,11 @@
#!/bin/sh
# PREVENT Progress 1st swiftDialog from running
# DESCRIPTION
# Will create the file to prevent Progress 1st swiftDialog from running.
# Only for MDM solutions (like Addigy and Microsoft) that have conditions for runnning scripts and do not offer an enrollment event for runnning the script.
# By runninng this script, the file will be created on the client, that will prevent Progress 1st swiftDialog from runnning.
# This is a great help for implementing Progress 1st swiftDialog in a running solution, where the command below have to be run on currently enrolled devices, and then Progress 1st swiftDialog can be assigned to all machines, and will run only on newly enrolled devices.
/usr/bin/touch "/var/db/.Progress1stDone"

397
MDM/Progress 1st swiftDialog.sh Executable file
View File

@@ -0,0 +1,397 @@
#!/bin/sh
# Progress 1st with swiftDialog (auto installation at enrollment)
instance="" # Name of used instance
LOGO="" # "appstore", "jamf", "mosyleb", "mosylem", "addigy", "microsoft", "ws1"
apps=(
"swiftDialog,/usr/local/bin/dialog"
"dockutil,/usr/local/bin/dockutil"
"desktoppr,/usr/local/bin/desktoppr"
"SupportApp,/Applications/Support.app"
"Xink,/Applications/Xink.app"
"Apple NewYork Font,/Library/Fonts/NewYork.ttf"
"Apple SF Pro Font,/Library/Fonts/SF-Pro.ttf"
"Apple SF Mono Font,/Library/Fonts/SF-Mono-Bold.otf"
"Apple SF Compact Font,/Library/Fonts/SF-Compact.ttf"
"Zoho WorkDrive TrueSync,/Applications/Zoho WorkDrive TrueSync.app"
"TextMate,/Applications/TextMate.app"
"Sublime Text,/Applications/Sublime Text.app"
"1Password,/Applications/1Password 7.app"
"Mactracker,/Applications/Mactracker.app"
"WWDC,/Applications/WWDC.app"
"The Unarchiver,/Applications/The Unarchiver.app"
"Keka,/Applications/Keka.app"
"Brave,/Applications/Brave Browser.app"
"Firefox,/Applications/Firefox.app"
"Microsoft AutoUpdate,/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app"
"Microsoft Edge,/Applications/Microsoft Edge.app"
"Microsoft Teams,/Applications/Microsoft Teams.app"
"Microsoft Excel,/Applications/Microsoft Excel.app"
"Microsoft OneNote,/Applications/Microsoft OneNote.app"
"Microsoft Outlook,/Applications/Microsoft Outlook.app"
"Microsoft PowerPoint,/Applications/Microsoft PowerPoint.app"
"Microsoft Word,/Applications/Microsoft Word.app"
"Microsoft OneDrive,/Applications/OneDrive.app"
)
# Dialog display settings, change as desired
title="Installing Apps and other software"
message="Please wait while we download and install the needed software."
endMessage="Installation complete! Please reboot to activate FileVault."
displayEndMessageDialog=1 # Should endMessage be shown as a dialog? (0|1)
errorMessage="A problem was encountered setting up this Mac. Please contact IT."
######################################################################
# Progress 1st Dialog
#
# Showing installation progress using swiftDialog
# No customization below…
######################################################################
# Complete script meant for running via MDM on device enrollment. This will download
# and install Dialog on the fly before opening Dialog.
#
# Log: /private/var/log/InstallationProgress.log
# This file prevents script from running again on Addigy and Microsoft Endpoint (Intune):
# "/var/db/.Progress1stDone"
#
# Display a Dialog with a list of applications and indicate when theyve been installed
# Useful when apps are deployed at random, perhaps without local logging.
# Applies to Mosyle App Catalog installs, VPP app installs, Installomator installs etc.
# The script watches the existence of files in the file system, so that is used to show progress.
#
# Requires Dialog v1.9.1 or later (will be installed) https://github.com/bartreardon/swiftDialog
#
######################################################################
#
# This script made by Søren Theilgaard
# https://github.com/Theile
# Twitter and MacAdmins Slack: @theilgaard
#
# Based on the work by Adam Codega:
# https://github.com/acodega/dialog-scripts
#
# Some functions and code from Installomator:
# https://github.com/Installomator/Installomator
#
######################################################################
# List of apps/installs to process in “apps” array.
# Provide the display name as you prefer and the path to the app/file. ex:
# "Google Chrome,/Applications/Google Chrome.app"
# A comma separates the display name from the path. Do not use commas in your display name text.
#
# Tip: Check for something like print drivers using the pkg receipt, like:
# "Konica-Minolta drivers,/var/db/receipts/jp.konicaminolta.print.package.C759.plist"
# Or fonts, like:
# "Apple SF Pro Font,/Library/Fonts/SF-Pro.ttf"
######################################################################
scriptVersion="9.5"
# v. 9.5 : 2022-09-21 : change of GitHub download
# v. 9.4 : 2022-09-14 : downloadURL can fall back on GitHub API
# v. 9.3 : 2022-08-29 : Logging changed for current version. Improved installation with looping if it fails, so it can try again. Improved GitHub handling.
# v. 9.2.2 : 2022-06-17 : Improved Dialog installation. Check 1.1.1.1 for internet connection.
# v. 9.2 : 2022-05-19 : Not using GitHub api for download of Dialog, show a dialog when finished to make message more important. Now universal script for all supported MDMs based on LOGO variable.
# v. 9.0 : 2022-05-16 : Based on acodegas work, I have added progress bar, changed logging and use another log-location, a bit more error handling for Dialog download, added some "|| true"-endings to some lines to not make them fail in Addigy, and some more.
######################################################################
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Check before running
case $LOGO in
addigy|microsoft)
conditionFile="/var/db/.Progress1stDone"
# Addigy and Microsoft Endpoint Manager (Intune) need a check for a touched file
if [ -e "$conditionFile" ]; then
echo "$LOGO setup detected"
echo "$conditionFile exists, so we exit."
exit 0
else
echo "$conditionFile not found, so we continue…"
fi
;;
esac
# Mark: Constants and logging
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
log_message="$instance: Progress 1st with Dialog, v$scriptVersion"
label="P1st-v$scriptVersion"
log_location="/private/var/log/Installomator.log"
function printlog(){
timestamp=$(date +%F\ %T)
if [[ "$(whoami)" == "root" ]]; then
echo "$timestamp :: $label : $1" | tee -a $log_location
else
echo "$timestamp :: $label : $1"
fi
}
printlog "[LOG-BEGIN] ${log_message}"
# Internet check
if [[ "$(nc -z -v -G 10 1.1.1.1 53 2>&1 | grep -io "succeeded")" != "succeeded" ]]; then
printlog "ERROR. No internet connection, we cannot continue."
exit 90
fi
# Location of dialog and dialog command file
dialogApp="/usr/local/bin/dialog"
dialog_command_file="/var/tmp/dialog.log"
counterFile="/var/tmp/Progress1st.plist"
# Counters
progress_index=0
step_progress=0
defaults write $counterFile step -int 0
progress_total=${#apps[@]}
printlog "Total watched installations: $progress_total"
# Using LOGO variable to specify MDM and shown logo
case $LOGO in
appstore)
# Apple App Store on Mac
if [[ $(sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
;;
jamf)
# Jamf Pro
LOGO_PATH="/Library/Application Support/JAMF/Jamf.app/Contents/Resources/AppIcon.icns"
;;
mosyleb)
# Mosyle Business
LOGO_PATH="/Applications/Self-Service.app/Contents/Resources/AppIcon.icns"
;;
mosylem)
# Mosyle Manager (education)
LOGO_PATH="/Applications/Manager.app/Contents/Resources/AppIcon.icns"
;;
addigy)
# Addigy
LOGO_PATH="/Library/Addigy/macmanage/MacManage.app/Contents/Resources/atom.icns"
;;
microsoft)
# Microsoft Endpoint Manager (Intune)
LOGO_PATH="/Library/Intune/Microsoft Intune Agent.app/Contents/Resources/AppIcon.icns"
;;
ws1)
# Workspace ONE (AirWatch)
LOGO="/Applications/Workspace ONE Intelligent Hub.app/Contents/Resources/AppIcon.icns"
;;
esac
if [[ ! -a "${LOGO_PATH}" ]]; then
printlog "ERROR in LOGO_PATH '${LOGO_PATH}', setting Mac App Store."
if [[ $(/usr/bin/sw_vers -buildVersion) > "19" ]]; then
LOGO_PATH="/System/Applications/App Store.app/Contents/Resources/AppIcon.icns"
else
LOGO_PATH="/Applications/App Store.app/Contents/Resources/AppIcon.icns"
fi
fi
printlog "LOGO: $LOGO LOGO_PATH: $LOGO_PATH"
# Mark: Functions
# execute a dialog command
echo "" > $dialog_command_file || true
function dialog_command(){
printlog "Dialog-command: $1"
echo "$1" >> $dialog_command_file || true
}
function appCheck(){
dialog_command "listitem: $(echo "$app" | cut -d ',' -f1): wait"
while [ ! -e "$(echo "$app" | cut -d ',' -f2)" ]; do
sleep 2
done
dialog_command "progresstext: Install of “$(echo "$app" | cut -d ',' -f1)” complete"
dialog_command "listitem: $(echo "$app" | cut -d ',' -f1): ✅"
progress_index=$(defaults read $counterFile step)
progress_index=$(( progress_index + 1 ))
defaults write $counterFile step -int $progress_index
dialog_command "progress: $progress_index"
printlog "at item number $progress_index"
}
# Notify the user using AppleScript
function displayDialog(){
if [[ "$currentUser" != "" ]]; then
launchctl asuser $currentUserID sudo -u $currentUser osascript -e "button returned of (display dialog \"$message\" buttons {\"OK\"} default button \"OK\" with icon POSIX file \"$LOGO_PATH\")" || true
fi
}
# Mark: Code
name="Dialog"
printlog "$name check for installation"
# download URL, version and Expected Team ID
# Method for GitHub pkg w. app version check
gitusername="bartreardon"
gitreponame="swiftDialog"
#printlog "$gitusername $gitreponame"
filetype="pkg"
#downloadURL="https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
downloadURL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
if [[ "$(echo $downloadURL | grep -ioE "https.*.$filetype")" == "" ]]; then
printlog "Trying GitHub API for download URL."
downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")
fi
#printlog "$downloadURL"
appNewVersion=$(curl -sLI "https://github.com/$gitusername/$gitreponame/releases/latest" | grep -i "^location" | tr "/" "\n" | tail -1 | sed 's/[^0-9\.]//g')
#printlog "$appNewVersion"
expectedTeamID="PWA5E9TQ59"
destFile="/Library/Application Support/Dialog/Dialog.app"
versionKey="CFBundleShortVersionString" #CFBundleVersion
currentInstalledVersion="$(defaults read "${destFile}/Contents/Info.plist" $versionKey || true)"
printlog "${name} version: $currentInstalledVersion"
if [[ ! -e "${destFile}" || "$currentInstalledVersion" != "$appNewVersion" ]]; then
printlog "$name not found or version not latest."
printlog "${destFile}"
printlog "Installing version ${appNewVersion}"
# Create temporary working directory
tmpDir="$(mktemp -d || true)"
printlog "Created working directory '$tmpDir'"
# Download the installer package
printlog "Downloading $name package version $appNewVersion from: $downloadURL"
installationCount=0
exitCode=9
while [[ $installationCount -lt 3 && $exitCode -gt 0 ]]; do
curlDownload=$(curl -Ls "$downloadURL" -o "$tmpDir/$name.pkg" || true)
curlDownloadStatus=$(echo $?)
if [[ $curlDownloadStatus -ne 0 ]]; then
printlog "error downloading $downloadURL, with status $curlDownloadStatus"
printlog "${curlDownload}"
exitCode=1
else
printlog "Download $name succes."
# Verify the download
teamID=$(spctl -a -vv -t install "$tmpDir/$name.pkg" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' || true)
printlog "Team ID for downloaded package: $teamID"
# Install the package if Team ID validates
if [ "$expectedTeamID" = "$teamID" ] || [ "$expectedTeamID" = "" ]; then
printlog "$name package verified. Installing package '$tmpDir/$name.pkg'."
pkgInstall=$(installer -verbose -dumplog -pkg "$tmpDir/$name.pkg" -target "/" 2>&1)
pkgInstallStatus=$(echo $?)
if [[ $pkgInstallStatus -ne 0 ]]; then
printlog "ERROR. $name package installation failed."
printlog "${pkgInstall}"
exitCode=2
else
printlog "Installing $name package succes."
exitCode=0
fi
else
printlog "ERROR. Package verification failed for $name before package installation could start. Download link may be invalid."
exitCode=3
fi
fi
((installationCount++))
printlog "$installationCount time(s), exitCode $exitCode"
if [[ $installationCount -lt 3 ]]; then
if [[ $exitCode -gt 0 ]]; then
printlog "Sleep a bit before trying download and install again. $installationCount time(s)."
printlog "Remove $(rm -fv "$tmpDir/$name.pkg" || true)"
sleep 2
fi
else
printlog "Download and install of $name succes."
fi
done
# Remove the temporary working directory
printlog "Deleting working directory '$tmpDir' and its contents."
printlog "Remove $(rm -Rfv "${tmpDir}" || true)"
# Handle installation errors
if [[ $exitCode != 0 ]]; then
printlog "ERROR. Installation of $name failed. Aborting."
caffexit $exitCode
else
printlog "$name version $appNewVersion installed!"
fi
else
printlog "$name version $appNewVersion already found. Perfect!"
fi
while [ "$(pgrep -l "Setup Assistant")" != "" ]; do
printlog "Setup Assistant Still Running. PID $setupAssistantProcess."
sleep 1
done
printlog "Out of Setup Assistant."
while [ "$(pgrep -l "Finder")" = "" ]; do
printlog "Finder process not found. Assuming device is at login screen. PID $finderProcess"
sleep 1
done
printlog "Finder is running…"
currentUser=$(stat -f "%Su" /dev/console)
currentUserID=$(id -u "$currentUser")
printlog "Logged in user is $currentUser with ID $currentUserID"
# set icon based on whether computer is a desktop or laptop
#hwType=$(system_profiler SPHardwareDataType | grep "Model Identifier" | grep "Book" || true)
#if [ "$hwType" != "" ]; then
# LOGO_PATH="SF=laptopcomputer.and.arrow.down,weight=thin,colour1=#51a3ef,colour2=#5154ef"
#else
# LOGO_PATH="SF=desktopcomputer.and.arrow.down,weight=thin,colour1=#51a3ef,colour2=#5154ef"
#fi
dialogCMD="$dialogApp -p --title \"$title\" \
--message \"$message\" \
--icon \"$LOGO_PATH\" \
--progress $progress_total \
--button1text \"Please Wait\" \
--button1disabled"
# create the list of apps
listitems=""
for app in "${apps[@]}"; do
listitems="$listitems --listitem '$(echo "$app" | cut -d ',' -f1)'"
done
# final command to execute
dialogCMD="$dialogCMD $listitems"
printlog "$dialogCMD"
# Launch dialog and run it in the background sleep for a second to let thing initialise
printlog "About to launch Dialog."
eval "$dialogCMD" &
sleep 2
(for app in "${apps[@]}"; do
#step_progress=$(( 1 + progress_index ))
#dialog_command "progress: $step_progress"
sleep 0.5
appCheck &
done
wait)
# Mark: Finishing
# Prevent re-run of script if conditionFile is set
if [[ ! -z "$conditionFile" ]]; then
printlog "Touching condition file so script will not run again"
touch "$conditionFile" || true
printlog "$(ls -al "$conditionFile" || true)"
fi
# all done. close off processing and enable the "Done" button
printlog "Finalizing."
dialog_command "progresstext: $endMessage"
dialog_command "progress: complete"
dialog_command "button1text: Done"
dialog_command "button1: enable"
if [[ $displayEndMessageDialog -eq 1 ]]; then
message="$endMessage"
displayDialog &
fi
sleep 1
printlog $(rm -fv $dialog_command_file || true)
printlog $(rm -fv $counterFile || true)
printlog "Ending"

101
MDM/README.md Normal file
View File

@@ -0,0 +1,101 @@
# MDM scripts
This is a long list of various scripts for certain use in the various MDM solutions that we have used Installomator with.
There are two categories of MDMs. Either like Jamf Pro, that can contain the full script, and call that as a software installation (called policy in Jamf Pro). If the MDM cannot do that, it have to be able to run a script on the clients. That script can call Installomator on the client, and should therefore be locally installed.
## “Jamf”-folder
Here you have scripts for using swiftDialog as part of the Installomator installation. Showing progress in a small window. Separate [ReadMe-file](Jamf/ReadMe.md) in this folder.
## Script capable MDM-solutions
So for Mosyle, Addigy, and Microsoft Endpoint Manager (Intune), we have tested these scripts. If these works in other MDMs, let us know.
Especially for Addigy, and maybe also for other MDMs, `condition`-scripts has been added if software installation will run on certain conditions. Also `prevention`-scripts has been added, if you manually need to eliminate the runnning of a script, this can be needed if you want to use the enrollment script, but dont want it to run on the currently managed Macs Then you should sent out the `prevention`-script to make sure the file it creates is present on the Macs so the ordinary script will not do anything (it will detect this file and stop if found).
_The scripts utilizing __swiftDialog__ requires version 10 of __Installomator__, but will work with version 9. If runnning on version 9 it will set `NOTIFY=all` and use __Installomator__ notifications for showing progress, where as on version 10 it will be `NOTIFY=silent` as __swiftDialog__ is used instead._
### Shortenings
- SS — Self Service — scripts designed for use through a Self Service catalog
- VFA — valuesfromarguments — a custom label call to Installomator
# To be installed on all the Macs
In order for our MDM scripts to work, we need Installomator locally installed using the pkg we provide in our release.
So I suggest to install these on enrollment.
To utilize swiftDialog, we also need that installed.
If you need dockutil, that should be maintained as well, but if missing the MDM scripts will install it.
## Maintenance of Installomator, swiftDialog, and dockutil
I suggest to check weekly, and maybe at each boot, it newer versions have been released of these tools.
The verious MDMs have various ways of running scheduled, but it is possible.
### Scripts to use for installing these components
These do not require anything to be installed on macOS:
- `install Installomator direct.sh` — can be run at enrollment and as maintenance at any time to install __Installomator__.
- `install swiftDialog direct.sh` — can be used at enrollment and as maintenance at any time to install __swiftDialog__.
Once Installomator has been installed, __dockutil__ can be installed using Installomator (as a service), using this script:
- `App-install/App service Auto-install.sh` — This script uses pre-installed installomator to install dockutil.
# Enrollment scripts
For enrollment purposes, som 1st-scripts has been created. One is not showing anything to the end-user while running and another is using __DEPNotify__ to show progress (so hopefully the user will wait for the installation to finish):
- `Installomator 1st Auto-install DEPNotify.sh` — will install __DEPNotify__ first, start that up, and change progress on the installation bar at each installed label. Very good for Addigy.
- `Installomator 1st Auto-install.sh` — runnning silently installing Installomator labels in the given order. Can be used in combination with the Progress-script.
- `Progress 1st swiftDialog.sh` — It will install __swiftDialog__ and start that up with a list of software it will look for. It will look for an installed file/folder in the file system for each item. This is great for Mosyle that can install software using various methods, and then this script can show when it has been installed.
There are also Self Service scripts for this, if its somehow needed to have users running the installation manually.
# _App-install_ folders
Two different kinds of App-installation scripts have been made. Some that is very similar to the old provided scripts that are only using __Installomator__ for notifications (if any). And others that can use __swiftDialog__ for installation progress, and can also add the app to the Dock using __dockutil__.
## “App-install”-folder
- App browser-security Auto-install.sh
- App browser-security SS.sh
- App normal Auto-install.sh
- App normal SS.sh
- App service Auto-install.sh
- App VFA.sh
Here you can use scripts for Self Service (SS) or for Auto-install. THere will be a difference in how many notifications will be used and maybe handling of blocking processes.
What is also differentiated is what kind of app it is. Is it of the kind of browser, that can often have critical security fixes, then we dont want the user to postpone the installation, wheras a normal app can wait. A service app do not have to ask before installing, and should be able to install regardsliess if the app is currently running.
## “App-install SS with swiftDialog and dockutil”-folder
- App browser-security SS.sh
- App normal SS multi-app.sh
- App normal SS.sh
- App service SS.sh
- App VFA SS github.sh
- App VFA SS.sh
All of the notes for the above scripts are the same for these.
But these scripts utilize __swiftDialog__ to show a more live progress for the installation, and they also have a setting to use __dockutil__ to add the software to the Dock of the user.
# App-update
These script verifies if the app is already installed, before runnning Installomator.
- App browser-security Auto-install.sh
- App normal Auto-install.sh
These scripts only use Installomator, like “App-install”, but will check for the app to be installed first. Very usefull for Addigy and Microsoft.

View File

@@ -0,0 +1,17 @@
#!/bin/sh
# Mark: Addigy Condition
# Install on success
gitusername="Installomator"
gitreponame="Installomator"
appNewVersion=$(curl -sLI "https://github.com/$gitusername/$gitreponame/releases/latest" | grep -i "^location" | tr "/" "\n" | tail -1 | sed 's/[^0-9\.]//g')
destFile="/usr/local/Installomator/Installomator.sh"
if [[ ! -e "${destFile}" || "$(${destFile} version)" != "$appNewVersion" ]]; then
#echo "Let's install…"
exit 0
else
#echo "No need!"
exit 1
fi

View File

@@ -0,0 +1,149 @@
#!/bin/sh
######################################################################
# Installation of Installomator
#
# No customization below…
######################################################################
# This script can be used to install Installomator directly from GitHub.
######################################################################
#
# This script made by Søren Theilgaard
# https://github.com/Theile
# Twitter and MacAdmins Slack: @theilgaard
#
# Some functions and code from Installomator:
# https://github.com/Installomator/Installomator
#
######################################################################
scriptVersion="9.5"
# v. 9.5 : 2022-09-21 : change of GitHub download
# v. 9.4 : 2022-09-14 : downloadURL can fall back on GitHub API
# v. 9.3 : 2022-08-29 : Logging changed for current version. Improved installation with looping if it fails, so it can try again. Improved GitHub handling.
# v. 9.2.2 : 2022-06-17 : Check 1.1.1.1 for internet connection.
# v. 9.2 : 2022-05-19 : Built in installer for Installlomator. Universal script.
######################################################################
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Mark: Constants, logging and caffeinate
log_message="Installomator install, v$scriptVersion"
label="Inst-v$scriptVersion"
log_location="/private/var/log/Installomator.log"
printlog(){
timestamp=$(date +%F\ %T)
if [[ "$(whoami)" == "root" ]]; then
echo "$timestamp :: $label : $1" | tee -a $log_location
else
echo "$timestamp :: $label : $1"
fi
}
printlog "[LOG-BEGIN] ${log_message}"
# Internet check
if [[ "$(nc -z -v -G 10 1.1.1.1 53 2>&1 | grep -io "succeeded")" != "succeeded" ]]; then
printlog "ERROR. No internet connection, we cannot continue."
exit 90
fi
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid" || true
pkill caffeinate || true
printlog "[LOG-END] Status $1"
exit $1
}
name="Installomator"
printlog "$name check for installation"
# download URL, version and Expected Team ID
# Method for GitHub pkg with destFile
gitusername="Installomator"
gitreponame="Installomator"
#printlog "$gitusername $gitreponame"
filetype="pkg"
#downloadURL="https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
downloadURL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
if [[ "$(echo $downloadURL | grep -ioE "https.*.$filetype")" == "" ]]; then
printlog "Trying GitHub API for download URL."
downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")
fi
#printlog "$downloadURL"
appNewVersion=$(curl -sLI "https://github.com/$gitusername/$gitreponame/releases/latest" | grep -i "^location" | tr "/" "\n" | tail -1 | sed 's/[^0-9\.]//g')
#printlog "$appNewVersion"
expectedTeamID="JME5BW3F3R"
destFile="/usr/local/Installomator/Installomator.sh"
currentInstalledVersion="$(${destFile} version 2>/dev/null || true)"
printlog "${destFile} version: $currentInstalledVersion"
if [[ ! -e "${destFile}" || "$currentInstalledVersion" != "$appNewVersion" ]]; then
printlog "$name not found or version not latest."
printlog "${destFile}"
printlog "Installing version ${appNewVersion} ..."
# Create temporary working directory
tmpDir="$(mktemp -d || true)"
printlog "Created working directory '$tmpDir'"
# Download the installer package
printlog "Downloading $name package version $appNewVersion from: $downloadURL"
installationCount=0
exitCode=9
while [[ $installationCount -lt 3 && $exitCode -gt 0 ]]; do
curlDownload=$(curl -Ls "$downloadURL" -o "$tmpDir/$name.pkg" || true)
curlDownloadStatus=$(echo $?)
if [[ $curlDownloadStatus -ne 0 ]]; then
printlog "error downloading $downloadURL, with status $curlDownloadStatus"
printlog "${curlDownload}"
exitCode=1
else
printlog "Download $name succes."
# Verify the download
teamID=$(spctl -a -vv -t install "$tmpDir/$name.pkg" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' || true)
printlog "Team ID for downloaded package: $teamID"
# Install the package if Team ID validates
if [ "$expectedTeamID" = "$teamID" ] || [ "$expectedTeamID" = "" ]; then
printlog "$name package verified. Installing package '$tmpDir/$name.pkg'."
pkgInstall=$(installer -verbose -dumplog -pkg "$tmpDir/$name.pkg" -target "/" 2>&1)
pkgInstallStatus=$(echo $?)
if [[ $pkgInstallStatus -ne 0 ]]; then
printlog "ERROR. $name package installation failed."
printlog "${pkgInstall}"
exitCode=2
else
printlog "Installing $name package succes."
exitCode=0
fi
else
printlog "ERROR. Package verification failed for $name before package installation could start. Download link may be invalid."
exitCode=3
fi
fi
((installationCount++))
printlog "$installationCount time(s), exitCode $exitCode"
if [[ $installationCount -lt 3 ]]; then
if [[ $exitCode -gt 0 ]]; then
printlog "Sleep a bit before trying download and install again. $installationCount time(s)."
printlog "Remove $(rm -fv "$tmpDir/$name.pkg" || true)"
sleep 2
fi
else
printlog "Download and install of $name succes."
fi
done
# Remove the temporary working directory
printlog "Deleting working directory '$tmpDir' and its contents."
printlog "Remove $(rm -Rfv "${tmpDir}" || true)"
# Handle installation errors
if [[ $exitCode != 0 ]]; then
printlog "ERROR. Installation of $name failed. Aborting."
caffexit $exitCode
else
printlog "$name version $appNewVersion installed!"
fi
else
printlog "$name version $appNewVersion already found. Perfect!"
fi
caffexit 0

View File

@@ -0,0 +1,20 @@
#!/bin/sh
# Mark: Addigy Condition
# Install on success
gitusername="bartreardon"
gitreponame="swiftDialog"
appNewVersion=$(curl -sLI "https://github.com/$gitusername/$gitreponame/releases/latest" | grep -i "^location" | tr "/" "\n" | tail -1 | sed 's/[^0-9\.]//g')
destFile="/Library/Application Support/Dialog/Dialog.app"
versionKey="CFBundleShortVersionString" #CFBundleVersion
currentInstalledVersion="$(defaults read "${destFile}/Contents/Info.plist" $versionKey || true)"
if [[ ! -e "${destFile}" || "$currentInstalledVersion" != "$appNewVersion" ]]; then
#echo "Let's install…"
exit 0
else
#echo "No need!"
exit 1
fi

150
MDM/install swiftDialog direct.sh Executable file
View File

@@ -0,0 +1,150 @@
#!/bin/sh
######################################################################
# Installation of swiftDialog
#
# No customization below…
######################################################################
# This script can be used to install swiftDialog directly from GitHub.
######################################################################
#
# This script made by Søren Theilgaard
# https://github.com/Theile
# Twitter and MacAdmins Slack: @theilgaard
#
# Some functions and code from Installomator:
# https://github.com/Installomator/Installomator
#
######################################################################
scriptVersion="9.5"
# v. 9.5 : 2022-09-21 : change of GitHub download
# v. 9.4 : 2022-09-14 : downloadURL can fall back on GitHub API.
# v. 9.3 : 2022-08-29 : Logging changed for current version. Improved installation with looping if it fails, so it can try again. Improved GitHub handling.
# v. 9.2.2 : 2022-06-17 : Check 1.1.1.1 for internet connection.
# v. 9.2 : 2022-05-19 : Built in installer for Installlomator. Universal script.
######################################################################
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Mark: Constants, logging and caffeinate
log_message="Dialog install, v$scriptVersion"
label="Dialog-v$scriptVersion"
log_location="/private/var/log/Installomator.log"
printlog(){
timestamp=$(date +%F\ %T)
if [[ "$(whoami)" == "root" ]]; then
echo "$timestamp :: $label : $1" | tee -a $log_location
else
echo "$timestamp :: $label : $1"
fi
}
printlog "[LOG-BEGIN] ${log_message}"
# Internet check
if [[ "$(nc -z -v -G 10 1.1.1.1 53 2>&1 | grep -io "succeeded")" != "succeeded" ]]; then
printlog "ERROR. No internet connection, we cannot continue."
exit 90
fi
# No sleeping
/usr/bin/caffeinate -d -i -m -u &
caffeinatepid=$!
caffexit () {
kill "$caffeinatepid" || true
pkill caffeinate || true
printlog "[LOG-END] Status $1"
exit $1
}
name="Dialog"
printlog "$name check for installation"
# download URL, version and Expected Team ID
# Method for GitHub pkg w. app version check
gitusername="bartreardon"
gitreponame="swiftDialog"
#printlog "$gitusername $gitreponame"
filetype="pkg"
#downloadURL="https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
downloadURL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
if [[ "$(echo $downloadURL | grep -ioE "https.*.$filetype")" == "" ]]; then
printlog "Trying GitHub API for download URL."
downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")
fi
#printlog "$downloadURL"
appNewVersion=$(curl -sLI "https://github.com/$gitusername/$gitreponame/releases/latest" | grep -i "^location" | tr "/" "\n" | tail -1 | sed 's/[^0-9\.]//g')
#printlog "$appNewVersion"
expectedTeamID="PWA5E9TQ59"
destFile="/Library/Application Support/Dialog/Dialog.app"
versionKey="CFBundleShortVersionString" #CFBundleVersion
currentInstalledVersion="$(defaults read "${destFile}/Contents/Info.plist" $versionKey || true)"
printlog "${name} version: $currentInstalledVersion"
if [[ ! -e "${destFile}" || "$currentInstalledVersion" != "$appNewVersion" ]]; then
printlog "$name not found or version not latest."
printlog "${destFile}"
printlog "Installing version ${appNewVersion}"
# Create temporary working directory
tmpDir="$(mktemp -d || true)"
printlog "Created working directory '$tmpDir'"
# Download the installer package
printlog "Downloading $name package version $appNewVersion from: $downloadURL"
installationCount=0
exitCode=9
while [[ $installationCount -lt 3 && $exitCode -gt 0 ]]; do
curlDownload=$(curl -Ls "$downloadURL" -o "$tmpDir/$name.pkg" || true)
curlDownloadStatus=$(echo $?)
if [[ $curlDownloadStatus -ne 0 ]]; then
printlog "error downloading $downloadURL, with status $curlDownloadStatus"
printlog "${curlDownload}"
exitCode=1
else
printlog "Download $name succes."
# Verify the download
teamID=$(spctl -a -vv -t install "$tmpDir/$name.pkg" 2>&1 | awk '/origin=/ {print $NF }' | tr -d '()' || true)
printlog "Team ID for downloaded package: $teamID"
# Install the package if Team ID validates
if [ "$expectedTeamID" = "$teamID" ] || [ "$expectedTeamID" = "" ]; then
printlog "$name package verified. Installing package '$tmpDir/$name.pkg'."
pkgInstall=$(installer -verbose -dumplog -pkg "$tmpDir/$name.pkg" -target "/" 2>&1)
pkgInstallStatus=$(echo $?)
if [[ $pkgInstallStatus -ne 0 ]]; then
printlog "ERROR. $name package installation failed."
printlog "${pkgInstall}"
exitCode=2
else
printlog "Installing $name package succes."
exitCode=0
fi
else
printlog "ERROR. Package verification failed for $name before package installation could start. Download link may be invalid."
exitCode=3
fi
fi
((installationCount++))
printlog "$installationCount time(s), exitCode $exitCode"
if [[ $installationCount -lt 3 ]]; then
if [[ $exitCode -gt 0 ]]; then
printlog "Sleep a bit before trying download and install again. $installationCount time(s)."
printlog "Remove $(rm -fv "$tmpDir/$name.pkg" || true)"
sleep 2
fi
else
printlog "Download and install of $name succes."
fi
done
# Remove the temporary working directory
printlog "Deleting working directory '$tmpDir' and its contents."
printlog "Remove $(rm -Rfv "${tmpDir}" || true)"
# Handle installation errors
if [[ $exitCode != 0 ]]; then
printlog "ERROR. Installation of $name failed. Aborting."
caffexit $exitCode
else
printlog "$name version $appNewVersion installed!"
fi
else
printlog "$name version $appNewVersion already found. Perfect!"
fi
caffexit 0

151
MDM/swiftdialog_example.sh Executable file
View File

@@ -0,0 +1,151 @@
#!/bin/zsh
# runs through a list of Installomator items
# and displays status using Swift Dialog
#
# dependencies:
# - Swift Dialog: https://github.com/bartreardon/swiftDialog
# - Installomator: https://github.com/Installomator/Installomator
# this script will install both if they are not yet present
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# MARK: Variables
# set to 1 to not require root and not actually do any changes
# set to 0 for production
if [[ $1 == "NODEBUG" ]]; then
DEBUG=0
else
DEBUG=1
fi
# the label to install:
label="googlechromepkg"
# MARK: Constants
scriptDir=$(dirname ${0:A})
repoDir=$(dirname $scriptDir)
# if [[ $DEBUG -eq 1 ]]; then
installomator="$repoDir/utils/assemble.sh"
# else
# installomator="/usr/local/Installomator/Installomator.sh"
# fi
dialog="/usr/local/bin/dialog"
if [[ DEBUG -eq 0 ]]; then
dialog_command_file="/var/tmp/dialog.log"
else
dialog_command_file="$HOME/dialog.log"
fi
# MARK: Functions
dialogUpdate() {
# $1: dialog command
local dcommand=$1
if [[ -n $dialog_command_file ]]; then
echo "$dcommand" >> $dialog_command_file
echo "Dialog: $dcommand"
fi
}
progressUpdate() {
# $1: progress text (optional)
local text=$1
itemCounter=$((itemCounter + 1))
dialogUpdate "progress: $itemCounter"
if [[ -n $text ]]; then
dialogUpdate "progresstext: $text"
fi
}
startItem() {
local description=$1
echo "Starting Item: $description"
dialogUpdate "listitem: $description: wait"
progressUpdate $description
}
cleanupAndExit() {
# kill caffeinate process
if [[ -n $caffeinatePID ]]; then
echo "killing caffeinate..."
kill $caffeinatePID
fi
# clean up tmp dir
if [[ -n $tmpDir && -d $tmpDir ]]; then
echo "removing tmpDir $tmpDir"
rm -rf $tmpDir
fi
}
# MARK: sanity checks
# check minimal macOS requirement
if [[ $(sw_vers -buildVersion ) < "20" ]]; then
echo "This script requires at least macOS 11 Big Sur."
exit 98
fi
# check we are running as root
if [[ $DEBUG -eq 0 && $(id -u) -ne 0 ]]; then
echo "This script should be run as root"
exit 97
fi
# check for installomator
if [[ ! -x $installomator ]]; then
echo "Cannot find Installomator at $installomator"
exit 96
fi
# check for Swift Dialog
if [[ ! -x $dialog ]]; then
echo "Cannot find dialog at $dialog"
exit 95
fi
# MARK: Setup
# No sleeping
caffeinate -dimsu & caffeinatePID=$!
# trap exit for cleanup
trap cleanupAndExit EXIT
# display first screen
$dialog --title "Installing $label" \
--message "" \
--hideicon \
--mini \
--progress 100 \
--position bottomright \
--ontop \
--movable \
--commandfile $dialog_command_file & dialogPID=$!
sleep 0.1
$installomator $label \
DIALOG_CMD_FILE="$dialog_command_file" \
DEBUG=$DEBUG
# clean up UI
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Done"
sleep 0.5
dialogUpdate "quit:"

185
MDM/swiftdialog_list.sh Executable file
View File

@@ -0,0 +1,185 @@
#!/bin/zsh
# runs through a list of Installomator items
# and displays status using Swift Dialog
#
# dependencies:
# - Swift Dialog: https://github.com/bartreardon/swiftDialog
# - Installomator: https://github.com/Installomator/Installomator
# this script will install both if they are not yet present
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# MARK: Variables
# set to 1 to not require root and not actually do any changes
# set to 0 for production
if [[ $1 == "NODEBUG" ]]; then
DEBUG=0
else
DEBUG=1
fi
# list of Installomator labels
items=(
"firefoxpkg|Firefox"
"error|Expected Error"
"googlechromepkg|Google Chrome"
)
# MARK: Constants
scriptDir=$(dirname ${0:A})
repoDir=$(dirname $scriptDir)
# if [[ $DEBUG -eq 1 ]]; then
installomator="$repoDir/utils/assemble.sh"
# else
# installomator="/usr/local/Installomator/Installomator.sh"
# fi
dialog="/usr/local/bin/dialog"
if [[ DEBUG -eq 0 ]]; then
dialog_command_file="/var/tmp/dialog.log"
else
dialog_command_file="$HOME/dialog.log"
fi
# MARK: Functions
dialogUpdate() {
# $1: dialog command
local dcommand=$1
if [[ -n $dialog_command_file ]]; then
echo "$dcommand" >> $dialog_command_file
echo "Dialog: $dcommand"
fi
}
progressUpdate() {
# $1: progress text (optional)
local text=$1
itemCounter=$((itemCounter + 1))
dialogUpdate "progress: $itemCounter"
if [[ -n $text ]]; then
dialogUpdate "progresstext: $text"
fi
}
startItem() {
local description=$1
echo "Starting Item: $description"
dialogUpdate "listitem: $description: wait"
progressUpdate $description
}
installomator() {
# $1: label
# $2: description
local label=$1
local description=$2
$installomator $label \
DIALOG_CMD_FILE=${(q)dialog_command_file} \
DIALOG_LIST_ITEM_NAME=${(q)description} \
DEBUG=$DEBUG \
LOGGING=DEBUG
}
cleanupAndExit() {
# kill caffeinate process
if [[ -n $caffeinatePID ]]; then
echo "killing caffeinate..."
kill $caffeinatePID
fi
# clean up tmp dir
if [[ -n $tmpDir && -d $tmpDir ]]; then
echo "removing tmpDir $tmpDir"
rm -rf $tmpDir
fi
}
# MARK: sanity checks
# check minimal macOS requirement
if [[ $(sw_vers -buildVersion ) < "20" ]]; then
echo "This script requires at least macOS 11 Big Sur."
exit 98
fi
# check we are running as root
if [[ $DEBUG -eq 0 && $(id -u) -ne 0 ]]; then
echo "This script should be run as root"
exit 97
fi
# check for installomator
if [[ ! -x $installomator ]]; then
echo "Cannot find Installomator at $installomator"
exit 96
fi
# check for Swift Dialog
if [[ ! -x $dialog ]]; then
echo "Cannot find dialog at $dialog"
exit 95
fi
# MARK: Setup
# No sleeping
caffeinate -dimsu & caffeinatePID=$!
# trap exit for cleanup
trap cleanupAndExit EXIT
# setup first list
itemCount=$((${#items} + 1))
listitems=( )
for item in $items; do
label=$(cut -d '|' -f 1 <<< $item)
description=$(cut -d '|' -f 2 <<< $item)
listitems+=( "--listitem" ${description} )
done
# display first screen
$dialog --title "More Software" \
--icon "SF=gear" \
--message "We are downloading and installing some extra Apps..." \
--progress $itemCount \
"${listitems[@]}" \
--button1disabled \
--big \
--ontop \
--liststyle compact \
--width 700 \
--commandfile $dialog_command_file & dialogPID=$!
sleep 0.1
itemCounter=0
for item in $items; do
label=$(cut -d '|' -f 1 <<< $item)
description=$(cut -d '|' -f 2 <<< $item)
startItem $description
installomator $label $description
done
# clean up UI
dialogUpdate "progress: complete"
dialogUpdate "progresstext: Finished"
dialogUpdate "button1: enable"
dialogUpdate "button1text: Done"

View File

@@ -7,6 +7,7 @@ if ! is-at-least 10.14 $installedOSversion; then
exit 98
fi
# MARK: argument parsing
if [[ $# -eq 0 ]]; then
if [[ -z $label ]]; then # check if label is set inside script
@@ -24,7 +25,7 @@ fi
while [[ -n $1 ]]; do
if [[ $1 =~ ".*\=.*" ]]; then
# if an argument contains an = character, send it to eval
printlog "setting variable from argument $1" WARN
printlog "setting variable from argument $1" INFO
eval $1
else
# assume it's a label
@@ -99,6 +100,16 @@ if [[ "$(whoami)" != "root" && "$DEBUG" -eq 0 ]]; then
cleanupAndExit 6 "not running as root, exiting" ERROR
fi
# check Swift Dialog presence and version
DIALOG_CMD="/usr/local/bin/dialog"
if [[ ! -x $DIALOG_CMD ]]; then
# Swift Dialog is not installed, clear cmd file variable to ignore
printlog "SwiftDialog is not installed, clear cmd file var"
DIALOG_CMD_FILE=""
fi
# MARK: labels in case statement
case $label in
longversion)

View File

@@ -1,6 +1,7 @@
wickrme)
# credit: Søren Theilgaard (@theilgaard)
# Label not working, haven't found a solution
name="WickrMe"
printlog "Label for $name broken in test" WARN
type="dmg"
downloadURL=$( curl -fs https://me-download.wickr.com/api/download/me/download/mac | tr '"' '\n' | grep -e '^https://' )
appNewVersion=$( echo ${downloadURL} | sed -E 's/.*\/[a-zA-Z]*-([0-9.]*)\..*/\1/g' )

View File

@@ -1,6 +1,7 @@
wickrpro)
# credit: Søren Theilgaard (@theilgaard)
# Label not working, haven't found a solution
name="WickrPro"
printlog "Label for $name broken in test" WARN
type="dmg"
downloadURL=$( curl -fs https://me-download.wickr.com/api/download/pro/download/mac | tr '"' '\n' | grep -e '^https://' )
appNewVersion=$( echo ${downloadURL} | sed -E 's/.*\/[a-zA-Z]*-([0-9.]*)\..*/\1/g' )

View File

@@ -14,12 +14,15 @@ cleanupAndExit() { # $1 = exit code, $2 message, $3 level
printlog "Debugging enabled, Deleting tmpDir output was:\n$deleteTmpOut" DEBUG
fi
# If we closed any processes, reopen the app again
reopenClosedProcess
if [[ -n $2 && $1 -ne 0 ]]; then
printlog "ERROR: $2" $3
updateDialog "fail" "Error ($1; $2)"
else
printlog "$2" $3
updateDialog "success" ""
fi
printlog "################## End Installomator, exit code $1 \n" REQ
@@ -61,9 +64,12 @@ displaynotification() { # $1: message $2: title
message=${1:-"Message"}
title=${2:-"Notification"}
manageaction="/Library/Application Support/JAMF/bin/Management Action.app/Contents/MacOS/Management Action"
hubcli="/usr/local/bin/hubcli"
if [[ -x "$manageaction" ]]; then
"$manageaction" -message "$message" -title "$title"
elif [[ -x "$hubcli" ]]; then
"$hubcli" notify -t "$title" -i "$message" -c "Dismiss"
else
runAsUser osascript -e "display notification \"$message\" with title \"$title\""
fi
@@ -156,14 +162,22 @@ downloadURLFromGit() { # $1 git user name, $2 git repo name
fi
if [ -n "$archiveName" ]; then
downloadURL=$(curl -L --silent --fail "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" \
| awk -F '"' "/browser_download_url/ && /$archiveName\"/ { print \$4; exit }")
downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$archiveName\"/ { print \$4; exit }")
if [[ "$(echo $downloadURL | grep -ioE "https.*$archiveName")" == "" ]]; then
printlog "GitHub API not returning URL, trying https://github.com/$gitusername/$gitreponame/releases/latest."
#downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*$archiveName" | head -1)
downloadURL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*$archiveName" | head -1)"
fi
else
downloadURL=$(curl -L --silent --fail "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" \
| awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")
downloadURL=$(curl -sfL "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | awk -F '"' "/browser_download_url/ && /$filetype\"/ { print \$4; exit }")
if [[ "$(echo $downloadURL | grep -ioE "https.*.$filetype")" == "" ]]; then
printlog "GitHub API not returning URL, trying https://github.com/$gitusername/$gitreponame/releases/latest."
#downloadURL=https://github.com$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)
downloadURL="https://github.com$(curl -sfL "$(curl -sfL "https://github.com/$gitusername/$gitreponame/releases/latest" | tr '"' "\n" | grep -i "expanded_assets" | head -1)" | tr '"' "\n" | grep -i "^/.*\/releases\/download\/.*\.$filetype" | head -1)"
fi
fi
if [ -z "$downloadURL" ]; then
cleanupAndExit 9 "could not retrieve download URL for $gitusername/$gitreponame" ERROR
cleanupAndExit 14 "could not retrieve download URL for $gitusername/$gitreponame" ERROR
else
echo "$downloadURL"
return 0
@@ -176,7 +190,8 @@ versionFromGit() {
gitusername=${1?:"no git user name"}
gitreponame=${2?:"no git repo name"}
appNewVersion=$(curl -L --silent --fail "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | grep tag_name | cut -d '"' -f 4 | sed 's/[^0-9\.]//g')
#appNewVersion=$(curl -L --silent --fail "https://api.github.com/repos/$gitusername/$gitreponame/releases/latest" | grep tag_name | cut -d '"' -f 4 | sed 's/[^0-9\.]//g')
appNewVersion=$(curl -sLI "https://github.com/$gitusername/$gitreponame/releases/latest" | grep -i "^location" | tr "/" "\n" | tail -1 | sed 's/[^0-9\.]//g')
if [ -z "$appNewVersion" ]; then
printlog "could not retrieve version number for $gitusername/$gitreponame" WARN
appNewVersion=""
@@ -278,7 +293,11 @@ getAppVersion() {
printlog "Replacing App Store apps, no matter the version" WARN
appversion=0
else
cleanupAndExit 1 "App previously installed from App Store, and we respect that" ERROR
if [[ $DIALOG_CMD_FILE != "" ]]; then
updateDialog "wait" "Already installed from App Store. Not replaced."
sleep 4
fi
cleanupAndExit 23 "App previously installed from App Store, and we respect that" ERROR
fi
fi
else
@@ -427,6 +446,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir
# verify with spctl
printlog "Verifying: $appPath" INFO
updateDialog "wait" "Verifying..."
printlog "App size: $(du -sh "$appPath")" DEBUG
appVerify=$(spctl -a -vv "$appPath" 2>&1 )
appVerifyStatus=$(echo $?)
@@ -454,6 +474,10 @@ installAppWithPath() { # $1: path to app to install in $targetDir
printlog "notifying"
displaynotification "$message" "No update for $name!"
fi
if [[ $DIALOG_CMD_FILE != "" ]]; then
updateDialog "wait" "Latest version already installed..."
sleep 2
fi
cleanupAndExit 0 "No new version to install" REG
else
printlog "Using force to install anyway."
@@ -475,7 +499,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir
printlog "notifying"
displaynotification "$message" "Error updating $name!"
fi
cleanupAndExit 6 "Installed macOS is too old for this app." ERROR
cleanupAndExit 15 "Installed macOS is too old for this app." ERROR
fi
fi
@@ -534,7 +558,7 @@ installAppWithPath() { # $1: path to app to install in $targetDir
deduplicatelogs "$CLIoutput"
if [ $CLIstatus -ne 0 ] ; then
cleanupAndExit 3 "Error installing $mountname/$CLIInstaller $CLIArguments error:\n$logoutput" ERROR
cleanupAndExit 16 "Error installing $mountname/$CLIInstaller $CLIArguments error:\n$logoutput" ERROR
else
printlog "Succesfully ran $mountname/$CLIInstaller $CLIArguments" INFO
fi
@@ -572,6 +596,7 @@ installFromDMG() {
installFromPKG() {
# verify with spctl
printlog "Verifying: $archiveName"
updateDialog "wait" "Verifying..."
printlog "File list: $(ls -lh "$archiveName")" DEBUG
printlog "File type: $(file "$archiveName")" DEBUG
spctlOut=$(spctl -a -vv -t install "$archiveName" 2>&1 )
@@ -619,6 +644,10 @@ installFromPKG() {
printlog "notifying"
displaynotification "$message" "No update for $name!"
fi
if [[ $DIALOG_CMD_FILE != "" ]]; then
updateDialog "wait" "Latest version already installed..."
sleep 2
fi
cleanupAndExit 0 "No new version to install" REQ
else
printlog "Using force to install anyway."
@@ -639,8 +668,29 @@ installFromPKG() {
# install pkg
printlog "Installing $archiveName to $targetDir"
pkgInstall=$(installer -verbose -dumplog -pkg "$archiveName" -tgt "$targetDir" 2>&1)
pkgInstallStatus=$(echo $?)
if [[ $DIALOG_CMD_FILE != "" ]]; then
# pipe
pipe="$tmpDir/installpipe"
# initialise named pipe for installer output
initNamedPipe create $pipe
# run the pipe read in the background
readPKGInstallPipe $pipe "$DIALOG_CMD_FILE" & installPipePID=$!
printlog "listening to output of installer with pipe $pipe and command file $DIALOG_CMD_FILE on PID $installPipePID" DEBUG
pkgInstall=$(installer -verboseR -pkg "$archiveName" -tgt "$targetDir" 2>&1 | tee $pipe)
pkgInstallStatus=$pipestatus[1]
# because we are tee-ing the output, we want the pipe status of the first command in the chain, not the most recent one
killProcess $installPipePID
else
pkgInstall=$(installer -verbose -dumplog -pkg "$archiveName" -tgt "$targetDir" 2>&1)
pkgInstallStatus=$(echo $?)
fi
sleep 1
pkgEndTime=$(date "+$LogDateFormat")
pkgInstall+=$(echo "\nOutput of /var/log/install.log below this line.\n")
@@ -732,7 +782,7 @@ installPkgInZip() {
printlog "Found pkg(s):\n$findfiles" DEBUG
filearray=( ${(f)findfiles} )
if [[ ${#filearray} -eq 0 ]]; then
cleanupAndExit 20 "couldn't find pkg in zip $archiveName" ERROR
cleanupAndExit 21 "couldn't find pkg in zip $archiveName" ERROR
fi
# it is now safe to overwrite archiveName for installFromPKG
archiveName="${filearray[1]}"
@@ -745,7 +795,7 @@ installPkgInZip() {
findfiles=$(find "$tmpDir" -iname "$pkgName")
filearray=( ${(f)findfiles} )
if [[ ${#filearray} -eq 0 ]]; then
cleanupAndExit 20 "couldn't find pkg “$pkgName” in zip $archiveName" ERROR
cleanupAndExit 21 "couldn't find pkg “$pkgName” in zip $archiveName" ERROR
fi
# it is now safe to overwrite archiveName for installFromPKG
archiveName="${filearray[1]}"
@@ -768,7 +818,7 @@ installAppInDmgInZip() {
findfiles=$(find "$tmpDir" -iname "*.dmg" -maxdepth 2 )
filearray=( ${(f)findfiles} )
if [[ ${#filearray} -eq 0 ]]; then
cleanupAndExit 20 "couldn't find dmg in zip $archiveName" ERROR
cleanupAndExit 22 "couldn't find dmg in zip $archiveName" ERROR
fi
archiveName="$(basename ${filearray[1]})"
# it is now safe to overwrite archiveName for installFromDMG
@@ -820,7 +870,8 @@ runUpdateTool() {
finishing() {
printlog "Finishing..."
sleep 10 # wait a moment to let spotlight catch up
sleep 3 # wait a moment to let spotlight catch up
getAppVersion
if [[ -z $appversion ]]; then
@@ -868,3 +919,113 @@ hasDisplaySleepAssertion() {
return 1
}
initNamedPipe() {
# create or delete a named pipe
# commands are "create" or "delete"
local cmd=$1
local pipe=$2
case $cmd in
"create")
if [[ -e $pipe ]]; then
rm $pipe
fi
# make named pipe
mkfifo -m 644 $pipe
;;
"delete")
# clean up
rm $pipe
;;
*)
;;
esac
}
readDownloadPipe() {
# reads from a previously created named pipe
# output from curl with --progress-bar. % downloaded is read in and then sent to the specified log file
local pipe=$1
local log=${2:-$DIALOG_CMD_FILE}
# set up read from pipe
while IFS= read -k 1 -u 0 char; do
if [[ $char =~ [0-9] ]]; then
keep=1
fi
if [[ $char == % ]]; then
updateDialog $progress "Downloading..."
progress=""
keep=0
fi
if [[ $keep == 1 ]]; then
progress="$progress$char"
fi
done < $pipe
}
readPKGInstallPipe() {
# reads from a previously created named pipe
# output from installer with -verboseR. % install status is read in and then sent to the specified log file
local pipe=$1
local log=${2:-$DIALOG_CMD_FILE}
local appname=${3:-$name}
while read -k 1 -u 0 char; do
if [[ $char == % ]]; then
keep=1
fi
if [[ $char =~ [0-9] && $keep == 1 ]]; then
progress="$progress$char"
fi
if [[ $char == . && $keep == 1 ]]; then
updateDialog $progress "Installing..."
progress=""
keep=0
fi
done < $pipe
}
killProcess() {
# will silently kill the specified PID
builtin kill $1 2>/dev/null
}
updateDialog() {
local state=$1
local message=$2
local listitem=${3:-$DIALOG_LIST_ITEM_NAME}
local cmd_file=${4:-$DIALOG_CMD_FILE}
local progress=""
if [[ $state =~ '^[0-9]' \
|| $state == "reset" \
|| $state == "increment" \
|| $state == "complete" \
|| $state == "indeterminate" ]]; then
progress=$state
fi
# when to cmdfile is set, do nothing
if [[ $cmd_file == "" ]]; then
return
fi
if [[ $listitem == "" ]]; then
# no listitem set, update main progress bar and progress text
if [[ $progress != "" ]]; then
echo "progress: $progress" >> $cmd_file
fi
if [[ $message != "" ]]; then
echo "progresstext: $name - $message" >> $cmd_file
fi
else
# list item has a value, so we update the progress and text in the list
if [[ $progress != "" ]]; then
echo "listitem: title: $listitem, statustext: $message, progress: $progress" >> $cmd_file
else
echo "listitem: title: $listitem, statustext: $message, status: $state" >> $cmd_file
fi
fi
}

View File

@@ -7,7 +7,7 @@ label="" # if no label is sent to the script, this will be used
# 2020-2021 Installomator
#
# inspired by the download scripts from William Smith and Sander Schram
#
#
# Contributers:
# Armin Briegel - @scriptingosx
# Isaac Ordonez - @issacatmann
@@ -23,7 +23,7 @@ export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# set to 0 for production, 1 or 2 for debugging
# while debugging, items will be downloaded to the parent directory of this script
# also no actual installation will be performed
# debug mode 1 will download to the directory the script is run in, but will not check the version
# debug mode 1 will download to the directory the script is run in, but will not check the version
# debug mode 2 will download to the temp directory, check for blocking processes, check the version, but will not install anything or remove the current version
DEBUG=1
@@ -34,7 +34,6 @@ NOTIFY=success
# - silent no notifications
# - all all notifications (great for Self Service installation)
# behavior when blocking processes are found
BLOCKING_PROCESS_ACTION=tell_user
# options:
@@ -81,6 +80,7 @@ LOGO=appstore
# - mosylem Mosyle Manager (Education)
# - addigy Addigy
# - microsoft Microsoft Endpoint Manager (Intune)
# - ws1 Workspace ONE (AirWatch)
# 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).
@@ -139,6 +139,26 @@ IGNORE_DND_APPS=""
# IGNORE_DND_APPS="firefox,Google Chrome,Safari,Microsoft Edge,Opera,Amphetamine,caffeinate"
# Swift Dialog integration
# These variables will allow Installomator to communicate progress with Swift Dialog
# https://github.com/bartreardon/swiftDialog
# This requires Swift Dialog 2.11.2 or higher.
DIALOG_CMD_FILE=""
# When this variable is set, Installomator will write Swift Dialog commands to this path.
# Installomator will not launch Swift Dialog. The process calling Installomator will have
# launch and configure Swift Dialog to listen to this file.
# See `MDM/swiftdialog_example.sh` for an example.
DIALOG_LIST_ITEM_NAME=""
# When this variable is set, progress for downloads and installs will be sent to this
# listitem.
# When the variable is unset, progress will be sent to Swift Dialog's main progress bar.
# NOTE: How labels work
# Each workflow label needs to be listed in the case statement below.
@@ -184,7 +204,7 @@ IGNORE_DND_APPS=""
# How we get version number from app. Possible values:
# - CFBundleShortVersionString
# - CFBundleVersion
# Not all software titles uses fields the same.
# Not all software titles uses fields the same.
# See Opera label.
#
# - appCustomVersion(){}: (optional function)

View File

@@ -0,0 +1,7 @@
abetterfinderrename11)
name="A Better Finder Rename 11"
type="dmg"
downloadURL="https://www.publicspace.net/download/ABFRX11.dmg"
appNewVersion=$(curl -fs "https://www.publicspace.net/app/signed_abfr11.xml" | xpath '(//rss/channel/item/enclosure/@sparkle:version)' 2>/dev/null | cut -d '"' -f 2)
expectedTeamID="7Y9KW4ND8W"
;;

View File

@@ -0,0 +1,9 @@
acroniscyberprotectconnect|\
remotix)
name="Acronis Cyber Protect Connect"
type="dmg"
downloadURL="https://go.acronis.com/AcronisCyberProtectConnect_ForMac"
versionKey="CFBundleVersion"
appNewVersion=$(curl -fsIL "${downloadURL}" | grep -i "^location" | sed -E 's/.*\/[a-zA-Z]*-[0-9.]*-([0-9.]*)\.dmg/\1/g')
expectedTeamID="ZU2TV78AA6"
;;

View File

@@ -0,0 +1,11 @@
acroniscyberprotectconnectagent|\
remotixagent)
name="Acronis Cyber Protect Connect Agent"
type="pkg"
#packageID="com.nulana.rxagentmac"
downloadURL="https://go.acronis.com/AcronisCyberProtectConnect_AgentForMac"
versionKey="CFBundleVersion"
appNewVersion=$(curl -fsIL "${downloadURL}" | grep -i "^location" | sed -E 's/.*\/[a-zA-Z]*-[0-9.]*-([0-9.]*)\.pkg/\1/g')
expectedTeamID="H629V387SY"
blockingProcesses=( NONE )
;;

View File

@@ -0,0 +1,8 @@
adobeacrobatprodc)
name="Adobe Acrobat Pro DC"
type="pkgInDmg"
downloadURL="https://trials.adobe.com/AdobeProducts/APRO/Acrobat_HelpX/osx10/Acrobat_DC_Web_WWMUI.dmg"
expectedTeamID="JQ525L2MZD"
blockingProcesses=( "Acrobat Pro DC" )
Company="Adobe"
;;

View File

@@ -1,18 +1,24 @@
adobecreativeclouddesktop)
name="Adobe Creative Cloud"
#appName="Install.app"
appName="Install.app"
type="dmg"
adobeurl="https://helpx.adobe.com/download-install/kb/creative-cloud-desktop-app-download.html"
if [[ $(arch) == "arm64" ]]; then
downloadURL=$(curl -fs "$adobeurl" | xmllint -html -xpath "string(//a[contains(@href,'osx10')][contains(text(),'Download')]/@href)" - 2> /dev/null)
elif [[ $(arch) == "i386" ]]; then
downloadURL=$(curl -fs "$adobeurl" | xmllint -html -xpath "string(//a[contains(@href,'macarm64')][contains(text(),'Download')]/@href)" - 2> /dev/null)
if pgrep -q "Adobe Installer"; then
printlog "Adobe Installer is running, not a good time to update." WARN
printlog "################## End $APPLICATION \n\n" INFO
exit 75
fi
#downloadURL=$(curl -fs "https://helpx.adobe.com/download-install/kb/creative-cloud-desktop-app-download.html" | grep -o "https*.*dmg" | head -1)
appNewVersion=$(curl -fs "https://helpx.adobe.com/creative-cloud/release-note/cc-release-notes.html" | grep "mandatory" | head -1 | grep -o "Version *.* released" | cut -d " " -f2)
if [[ "$(arch)" == "arm64" ]]; then
downloadURL=$(curl -fs "https://helpx.adobe.com/download-install/kb/creative-cloud-desktop-app-download.html" | grep -o 'https.*macarm64.*dmg' | head -1 | cut -d '"' -f1)
else
downloadURL=$(curl -fs "https://helpx.adobe.com/download-install/kb/creative-cloud-desktop-app-download.html" | grep -o 'https.*osx10.*dmg' | head -1 | cut -d '"' -f1)
fi
#appNewVersion=$(curl -fs "https://helpx.adobe.com/creative-cloud/release-note/cc-release-notes.html" | grep "mandatory" | head -1 | grep -o "Version *.* released" | cut -d " " -f2)
appNewVersion=$(echo $downloadURL | grep -o '[^x]*$' | cut -d '.' -f 1 | sed 's/_/\./g')
targetDir="/Applications/Utilities/Adobe Creative Cloud/ACC/"
installerTool="Install.app"
CLIInstaller="Install.app/Contents/MacOS/Install"
CLIArguments=(--mode=silent)
expectedTeamID="JQ525L2MZD"
blockingProcesses=( "Creative Cloud" )
Company="Adobe"
;;

View File

@@ -0,0 +1,27 @@
adobereaderdc-install)
name="Adobe Acrobat Reader DC"
type="pkgInDmg"
printlog "Changing IFS for Adobe Reader" INFO
SAVEIFS=$IFS
IFS=$'\n'
versions=( $( curl -s https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+"| head -n 30) )
local version
for version in $versions; do
version="${version//.}"
printlog "trying version: $version" INFO
local httpstatus=$(curl -X HEAD -s "https://ardownload2.adobe.com/pub/adobe/reader/mac/AcrobatDC/${version}/AcroRdrDC_${version}_MUI.dmg" --write-out "%{http_code}")
printlog "HTTP status for Adobe Reader full installer URL https://ardownload2.adobe.com/pub/adobe/reader/mac/AcrobatDC/${version}/AcroRdrDC_${version}_MUI.dmg is $httpstatus" DEBUG
if [[ "${httpstatus}" == "200" ]]; then
downloadURL="https://ardownload2.adobe.com/pub/adobe/reader/mac/AcrobatDC/${version}/AcroRdrDC_${version}_MUI.dmg"
unset httpstatus
break
fi
done
unset version
IFS=$SAVEIFS
appNewVersion=$i
expectedTeamID="JQ525L2MZD"
blockingProcesses=( "AdobeReader" )
Company="Adobe"
PatchName="AcrobatReader"
;;

View File

@@ -1,9 +1,44 @@
adobereaderdc-update)
name="Adobe Acrobat Reader DC"
type="pkgInDmg"
downloadURL=$(adobecurrent=`curl --fail --silent https://armmf.adobe.com/arm-manifests/mac/AcrobatDC/reader/current_version.txt | tr -d '.'` && echo https://ardownload2.adobe.com/pub/adobe/reader/mac/AcrobatDC/"$adobecurrent"/AcroRdrDC_"$adobecurrent"_MUI.dmg)
if [[ -d "/Applications/Adobe Acrobat Reader DC.app" ]]; then
printlog "Found /Applications/Adobe Acrobat Reader DC.app"
mkdir -p "/Library/Application Support/Adobe/Acrobat/11.0"
defaults write "/Library/Application Support/Adobe/Acrobat/11.0/com.adobe.Acrobat.InstallerOverrides.plist" ReaderAppPath "/Applications/Adobe Acrobat Reader DC.app"
if ! defaults read "/Applications/Adobe Acrobat Reader DC.app/Contents/Resources/AcroLocale.plist" ; then
printlog "Missing locale data, this will cause the updater to fail. Deleting Adobe Acrobat Reader DC.app and installing fresh." WARN
rm -Rf "/Applications/Adobe Acrobat Reader DC.app"
if [[ $1 == "/" ]]; then
printlog "Running through Jamf: $0." INFO
$0 $1 $2 $3 adobereaderdc-install ${5} ${6} ${7} ${8} ${9} ${10} ${11}
else
printlog "Installomator running locally: $0." INFO
$0 adobereaderdc-install ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11}
fi
fi
fi
adobecurrent=$(curl -sL https://armmf.adobe.com/arm-manifests/mac/AcrobatDC/reader/current_version.txt | tr -d '.')
if [[ "${adobecurrent}" != <-> ]]; then
printlog "Got an invalid response for the Adobe Reader Current Version: ${adobecurrent}" ERROR
printlog "################## End $APPLICATION \n\n" INFO
exit 50
fi
downloadURL=$(echo https://ardownload2.adobe.com/pub/adobe/reader/mac/AcrobatDC/"$adobecurrent"/AcroRdrDCUpd"$adobecurrent"_MUI.dmg)
reader_preinstall() {
if pgrep -a "AdobeReader" >/dev/null 2>&1; then
printlog "AdobeReader is still running, forcefully killing." WARN
killall AdobeReader
fi
}
preinstall="reader_preinstall"
updateTool="/usr/local/bin/RemoteUpdateManager"
updateToolArguments=( --productVersions=RDR )
appNewVersion=$(curl -s https://armmf.adobe.com/arm-manifests/mac/AcrobatDC/reader/current_version.txt)
#appNewVersion=$(curl -s -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15)" https://get.adobe.com/reader/ | grep ">Version" | sed -E 's/.*Version 20([0-9.]*)<.*/\1/g') # credit: Søren Theilgaard (@theilgaard)
updateToolLog="/Users/$currentUser/Library/Logs/RemoteUpdateManager.log"
updateToolLogDateFormat="%m/%d/%y %H:%M:%S"
expectedTeamID="JQ525L2MZD"
blockingProcesses=( "AdobeReader" )
Company=Adobe
PatchName=AcrobatReader
PatchSkip="YES"
;;

View File

@@ -0,0 +1,10 @@
archiwareb2go)
name="P5 Workstation"
type="pkgInDmg"
packageID="com.archiware.presstore"
appNewVersion=$(curl -sf https://www.archiware.com/download-p5 | grep -m 1 "ARCHIWARE P5 Version" | sed "s|.*Version \(.*\) -.*|\\1|")
downloadURL=$(appNrVersion=`sed 's/[^0-9]//g' <<< $appNewVersion` && echo https://p5-downloads.s3.amazonaws.com/awpst"$appNrVersion"-darwin.dmg)
pkgName=$(appNrVersion=`sed 's/[^0-9]//g' <<< $appNewVersion` && echo P5-Workstation-"$appNrVersion"-Install.pkg)
expectedTeamID="5H5EU6F965"
# blockingProcesses=( nsd )
;;

View File

@@ -0,0 +1,10 @@
archiwarepst)
name="P5"
type="pkgInDmg"
packageID="com.archiware.presstore"
appNewVersion=$(curl -sf https://www.archiware.com/download-p5 | grep -m 1 "ARCHIWARE P5 Version" | sed "s|.*Version \(.*\) -.*|\\1|")
downloadURL=$(appNrVersion=`sed 's/[^0-9]//g' <<< $appNewVersion` && echo https://p5-downloads.s3.amazonaws.com/awpst"$appNrVersion"-darwin.dmg)
pkgName=$(appNrVersion=`sed 's/[^0-9]//g' <<< $appNewVersion` && echo P5-"$appNrVersion"-Install.pkg)
expectedTeamID="5H5EU6F965"
# blockingProcesses=( nsd )
;;

View File

@@ -1,7 +1,13 @@
audacity)
name="Audacity"
type="dmg"
downloadURL=$(downloadURLFromGit audacity audacity)
if [[ $(arch) == "arm64" ]]; then
archiveName="audacity-macOS-[0-9.]*-arm64.dmg"
downloadURL=$(downloadURLFromGit audacity audacity)
elif [[ $(arch) == "i386" ]]; then
archiveName="audacity-macOS-[0-9.]*-x86_64.dmg"
downloadURL=$(downloadURLFromGit audacity audacity)
fi
appNewVersion=$(versionFromGit audacity audacity)
expectedTeamID="AWEYX923UX"
;;

View File

@@ -3,5 +3,5 @@ awsvpnclient)
type="pkg"
downloadURL="https://d20adtppz83p9s.cloudfront.net/OSX/latest/AWS_VPN_Client.pkg"
expectedTeamID="94KV3E626L"
appNewVersion=$(curl -is "https://beta2.communitypatch.com/jamf/v1/ba1efae22ae74a9eb4e915c31fef5dd2/patch/AWSVPNClient" | grep currentVersion | tr ',' '\n' | grep currentVersion | cut -d '"' -f 4)
#appNewVersion=$(curl -is "https://beta2.communitypatch.com/jamf/v1/ba1efae22ae74a9eb4e915c31fef5dd2/patch/AWSVPNClient" | grep currentVersion | tr ',' '\n' | grep currentVersion | cut -d '"' -f 4)
;;

View File

@@ -0,0 +1,8 @@
bitrix24)
name="Bitrix24"
type="dmg"
archiveName="bitrix24_desktop.dmg"
downloadURL="https://dl.bitrix24.com/b24/bitrix24_desktop.dmg"
expectedTeamID="5B3T3A994N"
blockingProcesses=( "Bitrix24" )
;;

View File

@@ -2,5 +2,6 @@ boxtools)
name="Box Tools"
type="pkg"
downloadURL="https://box-installers.s3.amazonaws.com/boxedit/mac/currentrelease/BoxToolsInstaller.pkg"
packageID="com.box.boxtools.installer.boxedit"
expectedTeamID="M683GB7CPW"
;;

View File

@@ -0,0 +1,7 @@
carboncopycloner)
name="Carbon Copy Cloner"
type="zip"
downloadURL=$(curl -fsIL "https://bombich.com/software/download_ccc.php?v=latest" | grep -i ^location | sed -E 's/.*(https.*\.zip).*/\1/g')
appNewVersion=$(sed -E 's/.*-([0-9.]*)\.zip/\1/g' <<< $downloadURL | sed 's/\.[^.]*$//')
expectedTeamID="L4F2DED5Q7"
;;

View File

@@ -0,0 +1,7 @@
charles)
name="Charles"
type="dmg"
appNewVersion=$(curl -fs https://www.charlesproxy.com/download/latest-release/ | sed -nE 's/.*version.*value="([^"]*).*/\1/p')
downloadURL="https://www.charlesproxy.com/assets/release/$appNewVersion/charles-proxy-$appNewVersion.dmg"
expectedTeamID="9A5PCU4FSD"
;;

View File

@@ -0,0 +1,11 @@
chronoagent)
name="ChronoAgent"
type="pkgInDmg"
# packageID="com.econtechnologies.preference.chronoagent"
# versionKey="CFBundleVersion"
# None of the above can read out the installed version
releaseURL="https://www.econtechnologies.com/UC/updatecheck.php?prod=ChronoAgent&lang=en&plat=mac&os=10.14.1&hw=i64&req=1&vers=#"
appNewVersion=$(curl -sf $releaseURL | sed -r 's/.*VERSION=([^<]+).*/\1/')
downloadURL="https://downloads.econtechnologies.com/CA_Mac_Download.dmg"
expectedTeamID="9U697UM7YX"
;;

View File

@@ -0,0 +1,8 @@
chronosync)
name="ChronoSync"
type="pkgInDmg"
releaseURL="https://www.econtechnologies.com/UC/updatecheck.php?prod=ChronoSync&lang=en&plat=mac&os=10.14.1&hw=i64&req=1&vers=#"
appNewVersion=$(curl -sf $releaseURL | sed -r 's/.*VERSION=([^<]+).*/\1/')
downloadURL="https://downloads.econtechnologies.com/CS4_Download.dmg"
expectedTeamID="9U697UM7YX"
;;

View File

@@ -1,7 +1,8 @@
clevershare2)
name="Clevershare"
type="dmg"
downloadURL=$(curl -fs https://www.clevertouch.com/eu/clevershare2g | grep -i -o -E "https.*Mac.*\.dmg")
appNewVersion=$( echo "${downloadURL}" | sed -E 's/.*\/[a-zA-Z-]*_Mac\.([0-9.]*)\.[0-9]*\.dmg$/\1/g' )
printlog "Label for $name broken in test" ERROR
downloadURL=$(curl -fs https://www.clevertouch.com/eu/clevershare2g | grep -i -o -E "https.*notarized.*\.dmg")
appNewVersion=$(echo "${downloadURL}" | sed -E 's/.*\/([0-9.]*)\/[0-9]*\/.*\.dmg$/\1/')
expectedTeamID="P76M9BE8DQ"
;;

View File

@@ -0,0 +1,7 @@
cocoapods)
name="CocoaPods"
type="bz2"
downloadURL="$(downloadURLFromGit CocoaPods CocoaPods-app)"
appNewVersion="$(versionFromGit CocoaPods CocoaPods-app)"
expectedTeamID="AX2Q2BH2XR"
;;

View File

@@ -0,0 +1,7 @@
coconutbattery)
name="coconutBattery"
type="zip"
downloadURL="https://coconut-flavour.com/downloads/coconutBattery_latest.zip"
appNewVersion=$(curl -fs https://www.coconut-flavour.com/coconutbattery/ | grep "<title>" | sed -e 's/.*coconutBattery \(.*\) - by coconut-flavour.co.*/\1/')
expectedTeamID="R5SC3K86L5"
;;

View File

@@ -1,7 +1,7 @@
coderunner)
# credit: Erik Stam (@erikstam)
name="CodeRunner"
type="zip"
downloadURL="https://coderunnerapp.com/download"
appNewVersion=$(curl -fsIL ${downloadURL} | grep -i "^location" | cut -d " " -f2 | sed -E 's/.*CodeRunner-([0-9.]*).zip/\1/')
expectedTeamID="R4GD98AJF9"
;;

View File

@@ -1,5 +1,5 @@
colourcontrastanalyser)
name="Colour Contrast Analyser (CCA)"
name="Colour Contrast Analyser"
type="dmg"
downloadURL=$(downloadURLFromGit ThePacielloGroup CCAe)
appNewVersion=$(versionFromGit ThePacielloGroup CCAe)

View File

@@ -0,0 +1,7 @@
cricutdesignspace)
name="Cricut Design Space"
type="dmg"
appNewVersion=$(getJSONValue "$(curl -fsL https://s3-us-west-2.amazonaws.com/staticcontent.cricut.com/a/software/osx-native/latest.json)" "rolloutVersion")
downloadURL=$(getJSONValue $(curl -fsL "https://apis.cricut.com/desktopdownload/InstallerFile?shard=a&operatingSystem=osxnative&fileName=CricutDesignSpace-Install-v${appNewVersion}.dmg") "result")
expectedTeamID="25627ZFVT7"
;;

View File

@@ -1,6 +1,12 @@
cryptomator)
name="Cryptomator"
type="dmg"
if [[ $(arch) == "arm64" ]]; then
archiveName="Cryptomator-[0-9.]*-arm64.dmg"
elif [[ $(arch) == "i386" ]]; then
archiveName="Cryptomator-[0-9.]*.dmg"
fi
downloadURL=$(downloadURLFromGit cryptomator cryptomator)
appNewVersion=$(versionFromGit cryptomator cryptomator)
expectedTeamID="YZQJQUHA3L"

View File

@@ -0,0 +1,11 @@
cytoscape)
name="Cytoscape"
#appName="Cytoscape Installer.app"
type="dmg"
downloadURL="$(downloadURLFromGit cytoscape cytoscape)"
appNewVersion="$(versionFromGit cytoscape cytoscape)"
installerTool="Cytoscape Installer.app"
CLIInstaller="Cytoscape Installer.app/Contents/MacOS/JavaApplicationStub"
CLIArguments=(-q)
expectedTeamID="35LDCJ33QT"
;;

View File

@@ -1,7 +1,7 @@
dangerzone)
name="Dangerzone"
type="dmg"
downloadURL="$(downloadURLFromGit firstlookmedia dangerzone)"
appNewVersion="$(versionFromGit firstlookmedia dangerzone)"
downloadURL="$(downloadURLFromGit freedomofpress dangerzone)"
appNewVersion="$(versionFromGit freedomofpress dangerzone)"
expectedTeamID="N9B95FDWH4"
;;

View File

@@ -1,7 +1,7 @@
drawio)
name="draw.io"
type="dmg"
archiveName="draw.io-universal-[0-9.]*.dmg"
archiveName="draw.io-universal-[0-9.]*.dmg$"
downloadURL="$(downloadURLFromGit jgraph drawio-desktop)"
appNewVersion="$(versionFromGit jgraph drawio-desktop)"
expectedTeamID="UZEUFB4N53"

View File

@@ -2,9 +2,9 @@ duckduckgo)
name="DuckDuckGo"
type="dmg"
#downloadURL="https://staticcdn.duckduckgo.com/macos-desktop-browser/duckduckgo.dmg"
#downloadURL=$(curl -fs https://staticcdn.duckduckgo.com/macos-desktop-browser/appcast.xml | xpath '(//rss/channel/item/enclosure/@url)[last()]' 2>/dev/null | cut -d '"' -f2)
downloadURL=$(curl -fs https://staticcdn.duckduckgo.com/macos-desktop-browser/appcast.xml | xpath '(//rss/channel/item/enclosure/@url)[1]' 2>/dev/null | cut -d '"' -f2)
#appNewVersion=$(curl -fs https://staticcdn.duckduckgo.com/macos-desktop-browser/appcast.xml | xpath '(//rss/channel/item/enclosure/@sparkle:version)[last()]' 2>/dev/null | cut -d '"' -f2)
appNewVersion=$(curl -fs https://staticcdn.duckduckgo.com/macos-desktop-browser/appcast.xml | xpath '(//rss/channel/item/sparkle:shortVersionString)[1]' 2>/dev/null | cut -d ">" -f2 | cut -d "<" -f1)
downloadURL=$(curl -fs https://staticcdn.duckduckgo.com/macos-desktop-browser/appcast.xml | xpath '(//rss/channel/item/enclosure/@url)[last()]' 2>/dev/null | cut -d '"' -f2)
#downloadURL=$(curl -fs https://staticcdn.duckduckgo.com/macos-desktop-browser/appcast.xml | xpath '(//rss/channel/item/enclosure/@url)[1]' 2>/dev/null | cut -d '"' -f2)
appNewVersion=$(curl -fs https://staticcdn.duckduckgo.com/macos-desktop-browser/appcast.xml | xpath '(//rss/channel/item/enclosure/@sparkle:version)[last()]' 2>/dev/null | cut -d '"' -f2)
#appNewVersion=$(curl -fs https://staticcdn.duckduckgo.com/macos-desktop-browser/appcast.xml | xpath '(//rss/channel/item/sparkle:shortVersionString)[1]' 2>/dev/null | cut -d ">" -f2 | cut -d "<" -f1)
expectedTeamID="HKE973VLUW"
;;

View File

@@ -0,0 +1,9 @@
duodevicehealth)
name="Duo Device Health"
type="pkgInDmg"
downloadURL="https://dl.duosecurity.com/DuoDeviceHealth-latest.dmg"
appNewVersion=$(curl -fsLIXGET "https://dl.duosecurity.com/DuoDeviceHealth-latest.dmg" | grep -i "^content-disposition" | sed -e 's/.*filename\=\"DuoDeviceHealth\-\(.*\)\.dmg\".*/\1/')
appName="Duo Device Health.app"
expectedTeamID="FNN8Z5JMFP"
;;

View File

@@ -0,0 +1,7 @@
dynalist)
name="Dynalist"
type="dmg"
downloadURL="https://dynalist.io/standalone/download?file=Dynalist.dmg"
appNewVersion=""
expectedTeamID="6JSW4SJWN9"
;;

7
fragments/labels/fellow Normal file
View File

@@ -0,0 +1,7 @@
fellow)
name="Fellow"
type="dmg"
downloadURL="https://fellow.app/desktop/download/darwin/latest/"
appNewVersion="$(curl -fsIL "${downloadURL}" | grep -i ^location | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/' | head -1)"
expectedTeamID="2NF46HY8D8"
;;

View File

@@ -0,0 +1,7 @@
fellow)
name="Fellow"
type="dmg"
downloadURL="https://cdn.fellow.app/desktop/1.3.11/darwin/stable/universal/Fellow-1.3.11-universal.dmg"
appNewVersion=""
expectedTeamID="2NF46HY8D8"
;;

View File

@@ -0,0 +1,8 @@
filemakerpro)
name="FileMaker Pro"
type="dmg"
versionKey="BuildVersion"
downloadURL=$(curl -fs https://www.filemaker.com/redirects/ss.txt | grep '\"PRO..MAC\"' | tail -1 | sed "s|.*url\":\"\(.*\)\".*|\\1|")
appNewVersion=$(curl -fs https://www.filemaker.com/redirects/ss.txt | grep '\"PRO..MAC\"' | tail -1 | sed "s|.*fmp_\(.*\).dmg.*|\\1|")
expectedTeamID="J6K4T76U7W"
;;

View File

@@ -0,0 +1,7 @@
flexoptixapp)
name="FLEXOPTIX App"
type="dmg"
downloadURL="https://flexbox.reconfigure.me/download/electron/mac/x64/current"
appNewVersion=$(curl -fsIL "${downloadURL}" | grep -i ^location | sed -E 's/.*-([0-9.]*)\.dmg/\1/g')
expectedTeamID="C5JETSFPHL"
;;

View File

@@ -0,0 +1,7 @@
fujifilmwebcam)
name="FUJIFILM X Webcam 2"
type="pkg"
downloadURL=$(curl -fs "https://fujifilm-x.com/en-us/support/download/software/x-webcam/" | grep "https.*pkg" | sed -E 's/.*(https:\/\/dl.fujifilm-x\.com\/support\/software\/.*\.pkg[^\<]).*/\1/g' | sed -e 's/^"//' -e 's/"$//')
appNewVersion=$( echo${downloadURL}| sed -E 's/.*XWebcamIns([0-9]*).*/\1/g' | sed -E 's/([0-9])([0-9]).*/\1\.\2/g')
expectedTeamID="34LRP8AV2M"
;;

View File

@@ -0,0 +1,7 @@
gfxcardstatus)
name="gfxCardStatus"
type="zip"
downloadURL="$(downloadURLFromGit codykrieger gfxCardStatus)"
appNewVersion="$(versionFromGit codykrieger gfxCardStatus)"
expectedTeamID="LF22FTQC25"
;;

View File

@@ -2,7 +2,11 @@ golang)
name="GoLang"
type="pkg"
packageID="org.golang.go"
downloadURL="https://go.dev$(curl -fs "https://go.dev/dl/" | grep -i "downloadBox" | grep "pkg" | tr '"' '\n' | grep "pkg")"
if [[ $(arch) == "arm64" ]]; then
downloadURL="https://go.dev$(curl -fs "https://go.dev/dl/" | grep -i "downloadBox" | grep "darwin-arm" | tr '"' '\n' | grep "pkg")"
elif [[ $(arch) == "i386" ]]; then
downloadURL="https://go.dev$(curl -fs "https://go.dev/dl/" | grep -i "downloadBox" | grep "darwin-amd" | tr '"' '\n' | grep "pkg")"
fi
appNewVersion="$( echo "${downloadURL}" | sed -E 's/.*\/(go[0-9.]*)\..*/\1/g' )" # Version includes letters "go" in the beginning
expectedTeamID="EQHXZ8M8AV"
blockingProcesses=( NONE )

View File

@@ -0,0 +1,7 @@
googleadseditor)
name="Google Ads Editor"
type="dmg"
downloadURL="https://dl.google.com/adwords_editor/google_ads_editor.dmg"
appNewVersion=""
expectedTeamID="EQHXZ8M8AV"
;;

View File

@@ -3,8 +3,13 @@ googledrivefilestream)
# credit: Isaac Ordonez, Mann consulting (@mannconsulting)
name="Google Drive File Stream"
type="pkgInDmg"
packageID="com.google.drivefs"
if [[ $(arch) == "arm64" ]]; then
packageID="com.google.drivefs.arm64"
elif [[ $(arch) == "i386" ]]; then
packageID="com.google.drivefs.x86_64"
fi
downloadURL="https://dl.google.com/drive-file-stream/GoogleDriveFileStream.dmg" # downloadURL="https://dl.google.com/drive-file-stream/GoogleDrive.dmg"
blockingProcesses=( "Google Docs" "Google Drive" "Google Sheets" "Google Slides" )
appName="Google Drive.app"
expectedTeamID="EQHXZ8M8AV"
;;

View File

@@ -2,9 +2,8 @@ grammarly)
name="Grammarly Desktop"
type="dmg"
packageID="com.grammarly.ProjectLlama"
downloadURL=$(curl -fsL "https://download-mac.grammarly.com/appcast.xml" | xpath '//rss/channel/item[1]/enclosure/@url' 2>/dev/null | cut -d '"' -f 2)
downloadURL="https://download-mac.grammarly.com/Grammarly.dmg"
expectedTeamID="W8F64X92K3"
appNewVersion=$(curl -is "https://download-mac.grammarly.com/appcast.xml" | grep sparkle:version | tr ',' '\n' | grep sparkle:version | cut -d '"' -f 4)
# appName="Grammarly Installer.app"
installerTool="Grammarly Installer.app"
CLIInstaller="Grammarly Installer.app/Contents/MacOS/Grammarly Desktop"

14
fragments/labels/horos.sh Normal file
View File

@@ -0,0 +1,14 @@
horos)
name="Horos"
type="dmg"
versionKey="CFBundleGetInfoString"
appNewVersion=$(curl -fs https://github.com/horosproject/horos/blob/horos/Horos/Info.plist | grep -A 4 "CFBundleGetInfoString" | tail -1 | sed -r 's/.*Horos v([^<]+).*/\1/' | sed 's/ //g')
if [[ $(arch) == "arm64" ]]; then
downloadURL="https://horosproject.org/horos-content/Horos"$appNewVersion"_Apple.dmg"
TeamID="8NDFEW7285"
elif [[ $(arch) == "i386" ]]; then
downloadURL="https://horosproject.org/horos-content/Horos"$appNewVersion".dmg"
TeamID="TPT6TVH8UY"
fi
expectedTeamID=$TeamID
;;

View File

@@ -1,8 +1,7 @@
icons)
# credit: Mischa van der Bent (@mischavdbent)
name="Icons"
type="zip"
downloadURL=$(downloadURLFromGit sap macOS-icon-generator )
appNewVersion=$(versionFromGit sap macOS-icon-generator )
downloadURL=$(downloadURLFromGit SAP macOS-icon-generator )
appNewVersion=$(versionFromGit SAP macOS-icon-generator )
expectedTeamID="7R5ZEU67FQ"
;;

View File

@@ -1,7 +1,9 @@
insomnia)
name="insomnia"
name="Insomnia"
type="dmg"
downloadURL=$(downloadURLFromGit kong insomnia)
appNewVersion=$(versionFromGit kong insomnia)
#downloadURL=$(downloadURLFromGit kong insomnia)
downloadURL=$(curl -fs "https://updates.insomnia.rest/downloads/mac/latest?app=com.insomnia.app&source=website" | grep -o "https.*\.dmg")
#appNewVersion=$(versionFromGit kong insomnia)
appNewVersion=$(echo "$downloadURL" | sed -E 's/.*\/Insomnia.Core.([0-9.]*)\.dmg/\1/')
expectedTeamID="FX44YY62GV"
;;

View File

@@ -0,0 +1,8 @@
ipswupdater)
name="IPSW Updater"
type="zip"
ipswupdaterVersions=$(curl -fs "https://ipsw.app/download/updates.php?current_version=0.9.16")
downloadURL=$(getJSONValue "$ipswupdaterVersions" "[0].url")
appNewVersion=$(getJSONValue "$ipswupdaterVersions" "[0].version")
expectedTeamID="YRW6NUGA63"
;;

14
fragments/labels/kap.sh Normal file
View File

@@ -0,0 +1,14 @@
kap)
# credit: Lance Stephens (@pythoninthegrass on MacAdmins Slack)
name="Kap"
type="dmg"
if [[ $(arch) = "i386" ]]; then
archiveName="${name}-[0-9.]*-x64.${type}"
downloadURL=$(downloadURLFromGit wulkano kap | grep -i x64)
else
archiveName="${name}-[0-9.]*-arm64.${type}"
downloadURL=$(downloadURLFromGit wulkano kap | grep -i arm64)
fi
appNewVersion=$(versionFromGit wulkano Kap)
expectedTeamID="2KEEHXF6R6"
;;

View File

@@ -0,0 +1,8 @@
keepingyouawake)
name="KeepingYouAwake"
type="zip"
downloadURL=$(downloadURLFromGit newmarcel KeepingYouAwake)
appNewVersion=$(versionFromGit newmarcel KeepingYouAwake)
expectedTeamID="5KESHV9W85"
blockingProcesses=( "KeepingYouAwake" )
;;

View File

@@ -1,7 +1,7 @@
knockknock)
name="KnockKnock"
type="zip"
downloadURL=$( curl -fs "https://objective-see.com/products/knockknock.html" | grep https | grep "$type" | head -1 | tr '"' "\n" | grep "^http" )
appNewVersion=$( echo "${downloadURL}" | sed -E 's/.*\/[a-zA-Z]*_([0-9.]*)\..*/\1/g' )
downloadURL="$(downloadURLFromGit objective-see KnockKnock)"
appNewVersion="$(versionFromGit objective-see KnockKnock)"
expectedTeamID="VBG97UB4TA"
;;

View File

@@ -0,0 +1,7 @@
latexit)
name="LaTeXiT"
type="dmg"
downloadURL="$(curl -fs "https://pierre.chachatelier.fr/latexit/downloads/latexit-sparkle-en.rss" | xpath '(//rss/channel/item/enclosure/@url)[last()]' 2>/dev/null | cut -d '"' -f 2)"
appNewVersion="$(curl -fs "https://pierre.chachatelier.fr/latexit/downloads/latexit-sparkle-en.rss" | xpath '(//rss/channel/item/enclosure/@sparkle:shortVersionString)[last()]' 2>/dev/null | cut -d '"' -f 2)"
expectedTeamID="7SFX84GNR7"
;;

View File

@@ -0,0 +1,7 @@
lcadvancedvpnclient)
name="LANCOM Advanced VPN Client"
type="pkgInDmg"
appNewVersion=$(curl -fs https://www.ncp-e.com/de/service/download-vpn-client/ | grep -m 1 "NCP Secure Entry macOS Client" -A 1 | grep -i Version | sed "s|.*Version \(.*\) Rev.*|\\1|")
downloadURL=$(appShortVersion=`sed 's/[^0-9]//g' <<< $appNewVersion` && echo https://ftp.lancom.de/LANCOM-Releases/LC-VPN-Client/LC-Advanced-VPN-Client-macOS-"${appShortVersion}"-Rel-x86-64.dmg)
expectedTeamID="LL3KBL2M3A"
;;

View File

@@ -13,7 +13,7 @@ macports)
archiveName="Catalina.pkg"
;;
*)
cleanupAndExit 1 "macOS 10.14 or earlier not supported by Installomator."
cleanupAndExit 98 "macOS 10.14 or earlier not supported by Installomator."
;;
esac
downloadURL=$(downloadURLFromGit macports macports-base)

Some files were not shown because too many files have changed in this diff Show More