Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An experimental script to burn Screenly Pro's disk image on Mac OS X.
#!/bin/bash
# Replace RELEASEPATH with the path to where you download the disk image
RELEASEPATH="$HOME/Downloads"
SD_DISK=$(mount | grep msdos | awk {'print $1'})
DISK_NO=$(echo $SD_DISK | awk '{print substr($0,length-2,1)}')
RDISK_BASE="/dev/rdisk"
RDISK=$RDISK_BASE$DISK_NO
clear
# Make sure we're root
if [ "$(whoami)" != 'root' ]; then
echo "This script must run as root"
exit 1;
fi
# Validate all strings
for i in "$RELEASEPATH" "$SD_DISK" "$DISK_NO"; do
if [ -z "$i" ]; then
echo "Found empty string base string. Aborting"
exit 1
fi
done
echo -e "Printing mounted disks:\n"
mount
echo -e "\n\nIs $SD_DISK ($RDISK) your SD card? (Y/N)"
read CONFIRM
if [[ "$CONFIRM" == "Y" ]]; then
echo "Unmounting $SD_DISK ..."
diskutil unmount $SD_DISK
cd "$RELEASEPATH"
LATEST_VERSION=$(ls -t *Pro_4GB.zip | head -n 1)
echo "Flashing out $LATEST_VERSION to $RDISK"
unzip -p $LATEST_VERSION | sudo dd bs=1m of=$RDISK
diskutil eject $SD_DISK
echo "Done."
else
echo "Aborting."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.