-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstallparttwo.sh
62 lines (51 loc) · 2.75 KB
/
installparttwo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
echo "--- Part 2: Updates and installation ---"
echo "--- Updating packages"
sudo apt --yes update
sudo apt --yes upgrade
echo "--- Installing packages via apt"
# needed for the CosmicPi software
sudo apt --yes install git python-pip htop python-numpy python-matplotlib python-flask mosquitto mosquitto-clients
echo "--- Installing python packages via pip"
sudo pip --no-cache-dir install pyserial configparser flask_googlemaps Flask-BasicAuth --extra-index-url https://www.piwheels.hostedpi.com/simple
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"
TOREPLACE="PATH_TO_EXECUTABLE"
echo "--- Setting up systemd services"
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
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/
sudo systemctl daemon-reload
sudo systemctl enable CosmicPi-mqtt.service
sudo systemctl enable CosmicPi-database_cleaner.service
sudo systemctl enable CosmicPi-detector.service
sudo systemctl enable CosmicPi-UI.service
#the ap was already done
echo "--- changing static ip address to 192.168.12.1 in standalone mode---"
cp -f dhcpcd.conf /etc/dhcpcd.conf
sudo systemctl stop dnsmasq
cp -f dnsmasq.conf /etc/dnsmasq.conf
sudo systemctl start dnsmasq
#echo"--- preventing this script from running next reboot ---"
#chmod +x normalrc.local
#sudo cp -f normalrc.local /etc/rc.local
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