diff --git a/.gitignore b/.gitignore index 87d0814..78f35dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,6 @@ .idea/ -storage/sqlite_db -storage/sqlite_db_edit -backend/1-5_raw_output.log +build *.log -some_file_location -/frontend/static/images/dashboard_histogram.png # Compiled python modules. *.pyc diff --git a/bin/dbcleaner b/bin/cosmicpi-dbcleaner similarity index 100% rename from bin/dbcleaner rename to bin/cosmicpi-dbcleaner diff --git a/bin/detector b/bin/cosmicpi-detector similarity index 100% rename from bin/detector rename to bin/cosmicpi-detector diff --git a/bin/mqtt b/bin/cosmicpi-mqtt similarity index 100% rename from bin/mqtt rename to bin/cosmicpi-mqtt diff --git a/bin/cosmicpi-postinstall b/bin/cosmicpi-postinstall new file mode 100755 index 0000000..e03fc6f --- /dev/null +++ b/bin/cosmicpi-postinstall @@ -0,0 +1,29 @@ +#!/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 diff --git a/bin/rest b/bin/cosmicpi-rest similarity index 100% rename from bin/rest rename to bin/cosmicpi-rest diff --git a/bin/ui b/bin/cosmicpi-ui similarity index 100% rename from bin/ui rename to bin/cosmicpi-ui diff --git a/install_files/cosmicpi-dbcleaner.service b/data_files/cosmicpi-dbcleaner.service similarity index 100% rename from install_files/cosmicpi-dbcleaner.service rename to data_files/cosmicpi-dbcleaner.service diff --git a/install_files/cosmicpi-detector.service b/data_files/cosmicpi-detector.service similarity index 100% rename from install_files/cosmicpi-detector.service rename to data_files/cosmicpi-detector.service diff --git a/install_files/cosmicpi-mqtt.service b/data_files/cosmicpi-mqtt.service similarity index 100% rename from install_files/cosmicpi-mqtt.service rename to data_files/cosmicpi-mqtt.service diff --git a/install_files/cosmicpi-ui.service b/data_files/cosmicpi-ui.service similarity index 100% rename from install_files/cosmicpi-ui.service rename to data_files/cosmicpi-ui.service diff --git a/install_files/cosmicpi.config b/data_files/cosmicpi.config similarity index 100% rename from install_files/cosmicpi.config rename to data_files/cosmicpi.config diff --git a/install_files/create_ap.conf b/data_files/create_ap.conf similarity index 100% rename from install_files/create_ap.conf rename to data_files/create_ap.conf diff --git a/dhcpcd.conf b/data_files/dhcpcd.conf similarity index 100% rename from dhcpcd.conf rename to data_files/dhcpcd.conf diff --git a/data_files/dnsmasq.conf b/data_files/dnsmasq.conf new file mode 100644 index 0000000..b8d0ab2 --- /dev/null +++ b/data_files/dnsmasq.conf @@ -0,0 +1,2 @@ +interface=wlan0 # Use the require wireless interface - usually wlan0 + dhcp-range=192.168.12.50,192.168.12.150,255.255.255.0,24h \ No newline at end of file diff --git a/documentation/CosmicPi_V15_serial_comm.txt b/docs/CosmicPi_V15_serial_comm.txt similarity index 100% rename from documentation/CosmicPi_V15_serial_comm.txt rename to docs/CosmicPi_V15_serial_comm.txt diff --git a/documentation/sqlite_database_specification.txt b/docs/sqlite_database_specification.txt similarity index 100% rename from documentation/sqlite_database_specification.txt rename to docs/sqlite_database_specification.txt diff --git a/install.sh b/install.sh deleted file mode 100644 index 97fcfe8..0000000 --- a/install.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -echo "In case of any issues please consult cosmicpi.org for help, or contact us via Facebook " - -echo "--- Part 1: Expand the file system ---" -echo "--- Expanding root file system ---" -#chmod +x rebootrc.local -sudo raspi-config --expand-rootfs -#cp -f rebootrc.local /etc/rc.local -chmod +x installparttwo.sh - -echo "--- Finished setup part 1! Rebooting, log back in and run sudo ./installparttwo.sh for part 2 ---" -sleep 10 -sudo reboot now diff --git a/installparttwo.sh b/installparttwo.sh deleted file mode 100755 index aac88ca..0000000 --- a/installparttwo.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/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 - -#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 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..93a133d --- /dev/null +++ b/setup.py @@ -0,0 +1,49 @@ +from setuptools import setup +from setuptools.command.install import install +import os + + +class PostInstall(install): + def run(self): + install.run(self) + os.system('cosmicpi-postinstall') + + +setup(name='cosmicpi', + version='1.5.2', + description='Open source cosmic ray detector', + long_description='The Cosmic Pi project aims to build the world\'s largest open source distributed cosmic ray telescope. You too can be a part of the project, by becoming a Cosmic Pixel!', + platforms=["noarch"], + maintainer='Cosmic Pi Team', + maintainer_email='info@cosmicpi.org', + url='http://cosmicpi.org/', + license='GPL V2', + packages=[ + 'cosmicpi', + 'cosmicpi.rest', + 'cosmicpi.storage', + 'cosmicpi.ui', + ], + data_files=[ + # ('/etc/systemd/system/', ['data_files/*.service']), + ('/etc', ['data_files/cosmicpi.config']), + ], + install_requires=[ + 'numpy', + 'matplotlib', + 'flask', + 'configparser', + 'pyserial', + ], + scripts=[ + 'bin/cosmicpi-dbcleaner', + 'bin/cosmicpi-detector', + 'bin/cosmicpi-mqtt', + 'bin/cosmicpi-rest', + 'bin/cosmicpi-ui', + 'bin/cosmicpi-postinstall', + ], + cmdclass={ + 'install': PostInstall, + }, +)