Skip to content

Instantly share code, notes, and snippets.

@stripedpurple
Created December 30, 2015 15:25
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 stripedpurple/8dbd0fa877d23d9bc695 to your computer and use it in GitHub Desktop.
Save stripedpurple/8dbd0fa877d23d9bc695 to your computer and use it in GitHub Desktop.
Installs MQTT broker (Mosquitto) on raspberry pi
#!/bin/sh
# Check to see if the script was run as Root
if [[ "$EUID" -ne 0 ]]; then
echo "Sorry, you need to run this as root"
exit 1
fi
cd /etc/apt/sources.list.d/
debVer=`lsb_release -a | grep -i codename | awk '{print $2}'`
if [ '$debVer' == 'jessie' ]; then
wget http://repo.mosquitto.org/debian/mosquitto-jessie.list
else if [ '$debVer' == 'wheezy' ]; then
wget http://repo.mosquitto.org/debian/mosquitto-wheezy.list
else
echo 'Sorry, but this script does not support your version of Raspbian! :('
exit 1
fi
apt-get update -y
apt-get install mosquitto -y
echo 'Enjoy!!!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment