Worklet: Install Box client on Mac

  • 9 August 2019
  • 2 replies
  • 117 views

Userlevel 7

This worklet will check to see if Box is installed and if it isn’t, will download and install it.

 

See this KB article for how to setup a worklet:

https://help.automox.com/hc/en-us/articles/5603324231700-Creating-a-Worklet

 

Evaluation Code:

 

 

#!/bin/bash



if [ -d "/Applications/Box Sync.app" ]; then

exit 0

else

exit 1

fi

 

Remediation Code:

 

 

#!/bin/bash



echo -e "Downloading Box Sync..."

curl -L -o "/tmp/Box Sync Installer.dmg" https://e3.boxcdn.net/box-installers/sync/Sync+4+External/Box%20Sync%20Installer.dmg



echo -e "Installing Box Sync..."

hdiutil attach "/tmp/Box Sync Installer.dmg" -nobrowse

ditto "/Volumes/Box Sync Installer/Box Sync.app" "/Applications/Box Sync.app"



echo -e "Cleaning up..."

hdiutil detach "/Volumes/Box Sync Installer"

rm -f "/tmp/Box Sync Installer.dmg"


This topic has been closed for comments

2 replies

Badge

Hi @Nic,


Jus wondering if you have the updated code for this worklet template? Box have two installer files right now, Box.pkg and BoxToolsinstaller.dmg.


Thanks!

Ulyssis

Userlevel 7

This is an old one and might need updating. The dmg file is the disk image that gets expanded, and it looks like the worklet is downloading that, mounting it, and copying the .app file to the applications directory.


A pkg file is a Mac installer that includes some scripts to put files in the right places and doesn’t just contain the .app file like the dmg file does. You might need to update the curl command to get the newer dmg file, or instead use the pkg file and run that to complete the install. Let me know if you get stuck and I can try getting it on my machine.


If you run it as is, does it actually install Box?