SCRIPT | Install-Dropbox-Latest

Install Dropbox

Summary

This script will install the latest version of Dropbox.


Script Content

#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"

# Set variables. These shouldn't need to change for each update
dmgname="DropBoxInstaller.dmg"
dmglink="https://www.dropbox.com/download?full=1&plat=mac"
dmgmountedname="Dropbox Offline Installer"
apptoreplace="Dropbox.app"
apptoreplacerunningname="Dropbox"
apptorun="/Applications/Dropbox.app"

# Download DMG
curl -L $dmglink > $dmgname

# Mount DMG 
hdiutil mount -nobrowse $dmgname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "/Volumes/$dmgmountedname/$apptoreplace" /Applications

# Update permissions on the copied APP in Applications
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff && chmod -R 755 "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"

# Remove the downloaded DMG
rm $dmgname

# Complete application install and initial setup
open "$apptorun"

unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset apptorun
unset netname

exit 0

Concluding Comments

The Dropbox desktop application makes sync’ing Dropbox contents to and from your Mac easier than ever.