Commit d2a0cec9 authored by Arnaud WATLET's avatar Arnaud WATLET
Browse files

Merge branch 'v2024_rc' of gitlab-ssh.irstea.fr:reversaal/OhmPi into v2024_rc

Showing with 52 additions and 1 deletion
+52 -1
#!/bin/bash
echo "=========== OhmPi installation script v1.0.0 =========="
echo "--------- Installing additional libraries via apt --------"
# ensure that the libatlas-base-dev library is installed
sudo apt-get install -y libatlas-base-dev libopenblas-dev
echo "----------- Creating virtual python environment ----------"
# Create the virtual environment
python3 -m venv ohmpy
......@@ -15,10 +21,14 @@ export CFLAGS=-fcommon
# install all required packages in the virtual environment.
pip install -r requirements.txt
echo "----------- Setting RPi parameters (I2C, GPIO, ...) --------"
# install a second i2c bus
sudo apt-get install -y i2c-tools
echo -e "[all]\ndtoverlay=i2c-gpio,bus=4,i2c_gpio_delay_us=1,i2c_gpio_sda=22,i2c_gpio_scl=23" | sudo tee -a /boot/config.txt
echo "-------------- Install local MQTT broker --------------"
# install local mqtt broker
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
......@@ -33,10 +43,15 @@ echo -e "\n${txtgrn}>>> Broker is installed. Starting now...${txtdef}"
mosquitto -v
echo -e "\n${txtgrn}>>> Updating configuration to allow anonymous remote connections and websockets...${txtdef}"
echo "listener 9001" | sudo tee -a /etc/mosquitto/mosquitto.conf
echo "listener 1883" | sudo tee -a /etc/mosquitto/mosquitto.conf
echo "listener 9001" | sudo tee -a /etc/mosquitto/mosquitto.conf
echo "protocol websockets" | sudo tee -a /etc/mosquitto/mosquitto.conf
echo "socket_domain ipv4" | sudo tee -a /etc/mosquitto/mosquitto.conf
echo "allow_anonymous true" | sudo tee -a /etc/mosquitto/mosquitto.conf
echo -e "\n${txtgrn}>>> Current configuration stored in /etc/mosquitto/mosquitto.conf is displayed below${txtdef}"
cat /etc/mosquitto/mosquitto.conf
echo "------------- Create config.py file -----------"
python setup_config.py
print('This assistent helps you configure a basic system with a measurement board and from 0 to 4 mux of the same type. For more complex configuration with multiple mux of different types, please have a look in the configs/ folder.')
mb = None
while True:
if mb in ['v2023', 'v2024']:
break
else:
mb = input('Choose a measurement boards: [v2023/v2024]: ')
mux = None
while True:
if mux in ['v2023', 'v2024']:
break
else:
mux = input('Choose a mux boards: [v2023/v2024]: ')
nb_mux = None
while True:
if nb_mux in ['0', '1', '2', '3', '4']:
break
else:
nb_mux = input('Number of multiplexers: [0, 1, 2, 3, 4]: ')
config = 'config_mb_' + mb[1:] + '_' + nb_mux + '_mux_' + mux[1:] + '.py'
print('Using this configuration: ' + config)
import os
import shutil
if os.path.exists('configs/' + config):
shutil.copyfile('configs/' + config, 'ohmpi/config.py')
else:
print('configuration not found')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment