Skip to content

Instantly share code, notes, and snippets.

@gjpalau
Created December 16, 2015 16:23
Show Gist options
  • Save gjpalau/4e94b6179fc2d64178fb to your computer and use it in GitHub Desktop.
Save gjpalau/4e94b6179fc2d64178fb to your computer and use it in GitHub Desktop.
FileWave Script for download and install of Box Sync + Box Edit
#!/bin/bash
# Original Script by Bryson Tyrrell | [email protected] | http://twitter.com/bryson3gps
# Modified on December 16, 2015 by Gilbert Palau | Univision Desktop Engineering | [email protected]
#
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'
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'
echo "Finished"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment