Skip to content

Instantly share code, notes, and snippets.

@jywarren
Forked from dwblair/autorun.sh
Last active August 29, 2015 14:22
Show Gist options
  • Save jywarren/b81659667ff42aa6b17a to your computer and use it in GitHub Desktop.
Save jywarren/b81659667ff42aa6b17a to your computer and use it in GitHub Desktop.
#!/bin/sh
# configure pirateship image
sudo pirateship rename shinyeippd42
sudo pirateship adapter pirate.sh/ip "" none
sudo ifdown wlan0
sudo ifup wlan0
# install opk drivers
cd /root
git clone https://github.com/jywarren/opk-phant-cli.git --branch stream-input
cd opk-phant-cli
npm install
cd ../
git clone https://github.com/jywarren/opk-shinyei-ppd42-cli.git
cd opk-shinyei-ppd42-cli
npm install
git clone https://github.com/jywarren/opk-sht1x-cli
cd opk-sht1x-cli
npm install
# jack in the box
cd /boot
mv autorun.sh autoran.sh
touch autorun.sh
chmod 755 autorun.sh
# regular autorun.sh
echo '#!/bin/sh' > /boot/autorun.sh
echo '' >> /boot/autorun.sh
echo 'cd /boot' >> /boot/autorun.sh
# note: replace the private key with your own; this is for the sandbox stream https://data.sparkfun.com/streams/lzELagraWDiMMRra0V6Q/
# note: '-s 2' on the next line refers to the number of seconds between reads. The Shinyei sensor specifies 30 seconds, but we use 2 seconds for easier testing.
echo './stream -s 2 --json | ../opk-phant-cli/push --url data.sparkfun.com --public_key lzELagraWDiMMRra0V6Q --private_key ElN4dKado1t99a6ykzEb --field_name misc --stream --json' >> /boot/autorun.sh
# the above line won't work yet - the shinyei needs to be run on a continuous 30s cycle
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment