#!/bin/bash

echo "--- Updating packages"
sudo apt --yes update
sudo apt --yes upgrade

echo "--- Installing packages via apt"
sudo apt --yes install git htop mosquitto mosquitto-clients

echo "--- Setting up services"
sudo systemctl daemon-reload
sudo systemctl enable cosmicpi-mqtt.service
sudo systemctl enable cosmicpi-dbcleaner.service
sudo systemctl enable cosmicpi-detector.service
sudo systemctl enable cosmicpi-ui.service

echo "--- Finished setup! Rebooting now, when this is done your Cosmic Pi should start working ---"
echo "--- To connect go to the IP address assigned by your network to the CosmicPi device, or  ---"
echo "--- cosmicpi.local if you have the correct type of browser. If you are operating in      ---"
echo "--- stand-alone mode via the CosmicPi wifi network, go directly to 192.168.12.1          ---"
echo "--- Note that this Cosmic Pi will automatically publish all cosmic ray and associated    ---"
echo "--- meta-data (position, accelerometer, magnetometer, temperature, humidity, pressure)   ---"
echo "--- to the internet for anyone to use under a CC0 license (no rights reserved)           ---"
echo "--- and placed in the public domain. For license details see:                            ---"
echo "--- https://creativecommons.org/share-your-work/public-domain/cc0/                       ---"             


# sleep 60
# sudo reboot now
