Skip to content

Instantly share code, notes, and snippets.

@stripedpurple
Last active September 19, 2018 21:05
Show Gist options
  • Save stripedpurple/33a5ffbd820df66b237d18b7d811de4f to your computer and use it in GitHub Desktop.
Save stripedpurple/33a5ffbd820df66b237d18b7d811de4f to your computer and use it in GitHub Desktop.
#!/bin/bash
# Check to see if the script was run as Root
if [[ "$EUID" -ne 0 ]]; then
log err "Sorry, you need to run this as root"
exit 1
fi
sudo apt install pv -y
umount /dev/mmcblk*
external=$(lsblk /dev/sd* | grep "^sd.*/media/ubuntu/" | grep -o "/media/ubuntu/.*")
cd $external
img=$(ls -1r *.img.gz | tail -1)
gunzip -c $img | pv > /dev/mmcblk*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment