Skip to content

Instantly share code, notes, and snippets.

@royashbrook
Last active May 17, 2017 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save royashbrook/b5b70a6f5dfbe25ffffc567127d8b516 to your computer and use it in GitHub Desktop.
Save royashbrook/b5b70a6f5dfbe25ffffc567127d8b516 to your computer and use it in GitHub Desktop.
image raspi
# first, download image to somewhere
# make a note of the location
# i am going to use:
# ~/Downloads/2017-04-10-raspbian-jessie-lite.img
read -n 1 -s -p "Download the image and press any key to continue..."
# i sudo bash first
sudo bash
# let's get the current disks
diskutil list >~/dl.1
# let's get the new disk
read -n 1 -s -p "Insert your SD card and press any key to continue..."
diskutil list >~/dl.2
diff ~/dl.1 ~/dl.2
rm ~/dl.1 ~/dl.2
# diff will show something like this:
# 14a15,20
# > /dev/disk2 (internal, physical):
# > #: TYPE NAME SIZE IDENTIFIER
# > 0: FDisk_partition_scheme *31.9 GB disk2
# > 1: Windows_FAT_32 boot 43.0 MB disk2s1
# > 2: Linux 31.9 GB disk2s2
# >
# make a note of the new disk. in the example above it is "2"
read -n 1 -s -p "Make a note of the disk# output from diff and press any key to continue..."
# I am using 2 below, if different change all disk numbers below
# also update img file path if it is different
# Below should be commented out so will need to get this info
: '
diskutil unmountDisk /dev/disk2
dd bs=1m if=~/Downloads/2017-04-10-raspbian-jessie-lite.img of=/dev/rdisk2
touch /volumes/boot/ssh
diskutil eject /dev/disk2
'
#assumes running script in current dir
tail -f ${0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment