Skip to content

Instantly share code, notes, and snippets.

@gjpalau
Created December 17, 2015 18:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gjpalau/8c248df987244b9e8818 to your computer and use it in GitHub Desktop.
Save gjpalau/8c248df987244b9e8818 to your computer and use it in GitHub Desktop.
Download and Install Box Edit 3.1.2 for Mac
#!/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
#
# The BoxEdit components Box Local Com Server.app and Box Edit.app are launched via launch_app.sh code
# added with permission of Elliot Jordan <elliot@lindegroup.com>
# launch_app was created on 02-10-2015 and last modified by Elliot Jordan on 02-27-2015 | v1.2
# Integrated on 12-18-2015 by Gilbert Palau | Univision Desktop Engineering | gpalau@univision.net
#
# Much thanks to Bryson, who figured out the command line to install from within the app...
# Install\ Box\ Tools.app/Contents/MacOS/Box\ Tools\ Installer -silent -local
policy="Box Edit 3.1.2"
loggertag="system-log-tag"
tmpdir="/tmp/"
downloadurl="https://e3.boxcdn.net/box-installers/boxedit/mac/currentrelease/BoxEditInstaller.dmg"
# Knock Knock... Who is there?
CURRENT_USER_LOGIN_PID=$(ps auxww | grep "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow" | grep "$CURRENT_USER" | grep -v "grep" | awk '{print $2}')
CURRENT_USER=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
# Download BoxEdit Package from EvilBox
echo ""
echo "Downloading Box Edit"
webCheckSum=$(curl -sI $downloadurl | tr -d '\r' | awk '/Content-Length/ {print $2}')
curl -fkS --progress-bar $downloadurl -o /$tmpdir/BoxEditInstaller.dmg
# curl -fkS --progress-bar https://e3.boxcdn.net/box-installers/boxedit/mac/currentrelease/BoxEditInstaller.dmg -o /tmp/BoxEditInstaller.dmg
fileCheckSum=$(cksum /$tmpdir/BoxEditInstaller.dmg | awk '{print $2}')
if [ $webCheckSum -ne $fileCheckSum ]; then
rm /$tmpdir/BoxEditInstaller.dmg
echo "The file did not download properly, exiting..."
exit 101
fi
echo "Mounting Box Edit DMG..."
hdiutil attach -quiet /$tmpdir/BoxEditInstaller.dmg
if [ $? -ne 0 ]; then
rm /$tmpdir/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 /$tmpdir/
hdiutil eject -quiet /Volumes/Box\ Tools\ Installer/
rm /$tmpdir/BoxEditInstaller.dmg
echo "Running the Box Edit Installer app"
# This is the golden goose... Thanks Bryson!
/usr/bin/su $CURRENT_USER -c "/$tmpdir/Install\ Box\ Tools.app/Contents/MacOS/Box\ Tools\ Installer -silent -local"
echo "Finished"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment