cosmicpi-rpi_V1.5/install

64 lines
2.1 KiB
Text
Raw Normal View History

2017-10-12 12:17:13 +00:00
#!/bin/bash
2017-10-25 00:07:53 +00:00
echo "--- Getting executable path"
EXECPATH="`dirname \"$0\"`" # relative
EXECPATH="`( cd \"$EXECPATH\" && pwd )`" # absolutized and normalized
if [ -z "$EXECPATH" ] ; then
# error; for some reason, the path is not accessible
# to the script (e.g. permissions re-evaled after suid)
exit 1 # fail
fi
echo "$EXECPATH"
2018-01-09 19:02:06 +00:00
TOREPLACE="PATH_TO_EXECUTABLE"
2017-10-25 00:07:53 +00:00
2017-10-25 18:50:34 +00:00
echo "--- Updating packages"
sudo apt --yes update
sudo apt --yes upgrade
2017-10-25 00:07:53 +00:00
2017-10-25 18:50:34 +00:00
echo "--- Installing packages via apt"
2017-11-02 02:46:14 +00:00
# needed for the CosmicPi software
2018-01-08 17:25:51 +00:00
sudo apt --yes install git python-pip htop python-numpy python-matplotlib python-flask mosquitto mosquitto-clients
2017-11-02 02:46:14 +00:00
# needed for create_ap
sudo apt --yes install git util-linux procps iproute2 iw haveged
2017-10-25 18:50:34 +00:00
echo "--- Installing python packages via pip"
2018-01-05 12:15:43 +00:00
sudo pip --no-cache-dir install pyserial configparser flask_googlemaps Flask-BasicAuth --extra-index-url https://www.piwheels.hostedpi.com/simple
2017-11-02 02:46:14 +00:00
echo "we might need some more packages"
2017-10-24 20:55:02 +00:00
2018-01-09 09:09:47 +00:00
#echo "--- Installing create_ap via git"
#git clone https://github.com/oblique/create_ap --depth 1
#cd create_ap
#sudo make install
#cd ..
#sudo rm -rf create_ap
2017-11-02 02:46:14 +00:00
# copy the config file
2018-01-09 09:09:47 +00:00
#sudo cp -f install_files/create_ap.conf /etc/create_ap.conf
echo "--- Installing captiveportal via git"
git clone https://github.com/CosmicPi/cosmic-captive
cd cosmic-captive
2018-01-09 09:09:47 +00:00
chmod +x install.sh
sudo ./install.sh
#it calls for a reboot now, but we'll do this after we've finished.
2017-10-24 20:55:02 +00:00
echo "--- Setting up systemd services"
2018-01-08 17:25:51 +00:00
sed -i -e "s+$TOREPLACE+$EXECPATH+g" install_files/CosmicPi-mqtt.service
sed -i -e "s+$TOREPLACE+$EXECPATH+g" install_files/CosmicPi-database_cleaner.service
2017-10-25 00:07:53 +00:00
sed -i -e "s+$TOREPLACE+$EXECPATH+g" install_files/CosmicPi-detector.service
sed -i -e "s+$TOREPLACE+$EXECPATH+g" install_files/CosmicPi-UI.service
sudo cp -f install_files/*.service /etc/systemd/system/
2017-10-24 20:55:02 +00:00
sudo systemctl daemon-reload
2018-01-08 17:25:51 +00:00
sudo systemctl enable CosmicPi-mqtt.service
sudo systemctl enable CosmicPi-database_cleaner.service
2017-11-02 02:46:14 +00:00
sudo systemctl enable CosmicPi-detector.service
sudo systemctl enable CosmicPi-UI.service
2018-01-09 09:09:47 +00:00
#sudo systemctl enable create_ap
#the ap was already done
2017-10-12 12:17:13 +00:00
echo "--- Finished setup! Rebooting now ---"
sleep 10
sudo reboot now