Last active
December 16, 2015 16:19
-
-
Save gjpalau/59bd040dcaf0335c5daa to your computer and use it in GitHub Desktop.
Script to download and deploy Box Sync and Box Edit for Mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Original Script by Bryson Tyrrell | bryson.tyrrell@gmail.com | http://twitter.com/bryson3gps | |
# Modified on December 16, 2015 by Gilbert Palau | Univision Desktop Engineering | gpalau@univision.net | |
# | |
installerOption="$4" | |
if [[ ${installerOption} = edit ]]; then | |
echo "" | |
echo "Downloading Box Edit" | |
webCheckSum=$(curl -sI https://e3.boxcdn.net/box-installers/boxedit/mac/currentrelease/BoxEditInstaller.dmg | tr -d '\r' | awk '/Content-Length/ {print $2}') | |
curl -fkS --progress-bar https://e3.boxcdn.net/box-installers/boxedit/mac/currentrelease/BoxEditInstaller.dmg -o /tmp/BoxEditInstaller.dmg | |
fileCheckSum=$(cksum /tmp/BoxEditInstaller.dmg | awk '{print $2}') | |
if [ $webCheckSum -ne $fileCheckSum ]; then | |
rm /tmp/BoxEditInstaller.dmg | |
echo "The file did not download properly, exiting..." | |
exit 101 | |
fi | |
echo "Mounting Box Edit DMG..." | |
hdiutil attach -quiet /tmp/BoxEditInstaller.dmg | |
if [ $? -ne 0 ]; then | |
rm /tmp/BoxEditInstaller.dmg | |
echo "The Box Edit DMG failed to mount properly, exiting..." | |
exit 102 | |
fi | |
cp -fR /Volumes/Box\ Tools\ Installer/Install\ Box\ Tools.app /tmp/ | |
hdiutil eject -quiet /Volumes/Box\ Tools\ Installer/ | |
rm /tmp/BoxEditInstaller.dmg | |
echo "Opening the Box Edit Installer app" | |
open -a /tmp/Install\ Box\ Tools.app | |
osascript -e "delay .5" -e 'tell application "Box Edit Installer" to activate' | |
elif [[ ${installerOption} = sync ]]; then | |
echo "" | |
echo "Downloading Box Sync" | |
webCheckSum=$(curl -sI https://e3.boxcdn.net/box-installers/sync/Sync+4+External/Box%20Sync%20Installer.dmg | tr -d '\r' | awk '/Content-Length/ {print $2}') | |
curl -fkS --progress-bar https://e3.boxcdn.net/box-installers/sync/Sync+4+External/Box%20Sync%20Installer.dmg -o /tmp/Box%20Sync%20Installer.dmg | |
fileCheckSum=$(cksum /tmp/Box%20Sync%20Installer.dmg | awk '{print $2}') | |
if [ $webCheckSum -ne $fileCheckSum ]; then | |
rm /tmp/Box%20Sync%20Installer.dmg | |
echo "The Box Sync DMG did not download properly, exiting..." | |
exit 101 | |
fi | |
echo "Mounting Box Sync DMG..." | |
hdiutil attach -quiet /tmp/Box%20Sync%20Installer.dmg | |
if [ $? -ne 0 ]; then | |
echo "The Box Sync DMG failed to mount properly, exiting..." | |
exit 103 | |
fi | |
cp -fR /Volumes/Box\ Sync\ Installer/Box\ Sync.app /tmp/ | |
hdiutil eject -quiet /Volumes/Box\ Sync\ Installer/ | |
rm -f /tmp/Box%20Sync%20Installer.dmg | |
echo "Opening the Box Sync Installer app" | |
open -a /tmp/Box\ Sync.app | |
osascript -e "delay .5" -e 'tell application "Box Sync Installer" to activate' | |
fi | |
echo "Finished" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment