Skip to content

Instantly share code, notes, and snippets.

@nrobinson2000
Created October 4, 2016 23:00
Show Gist options
  • Select an option

  • Save nrobinson2000/ba5552cdd423951e1ac0dc23cbfc34e9 to your computer and use it in GitHub Desktop.

Select an option

Save nrobinson2000/ba5552cdd423951e1ac0dc23cbfc34e9 to your computer and use it in GitHub Desktop.
Alpha phase setup script for Raspberry Pi
#!/bin/bash
echo "Raspberry Pi Alpha Setup tool:"
echo
echo "Installing Screen..."
sudo apt-get install screen
echo
read -rp "Enter your Device ID: " deviceID
echo "$deviceID" > device_id.txt
openssl genrsa 1024 | openssl rsa -outform DER -out device_key.der
curl https://s3.amazonaws.com/spark-website/cloud_public.der -o server_key.der
curl https://binaries.particle.io/raspberrypi/tinker -o firmware.bin
chmod +x firmware.bin
echo "
#!/bin/bash
cd /home/$USER
sudo ./firmware.bin -v 70 -i "$(cat device_id.txt)"
" > particle.sh
chmod +x particle.sh
echo
echo "Put the following inside of your \"/etc/rc.local\" file so that your pi will run tinker at boot:
echo
echo "screen -dmS particle /home/$USER/particle.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment