From d97eb23b5e00a0495b4db10a9431c11024e647ba Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 12 May 2026 18:56:02 +0200 Subject: [PATCH] Spostamento udpate vers 2.5/2.6 + creazione nuovo script update 3.1 che opera modifiche in IOB.cfg --- IOB-PI/{ => old-releases}/update_2.5.sh | 0 IOB-PI/{ => old-releases}/update_2.6.sh | 0 IOB-PI/update_3.1.sh | 286 ++++++++++++++++++++++++ 3 files changed, 286 insertions(+) rename IOB-PI/{ => old-releases}/update_2.5.sh (100%) rename IOB-PI/{ => old-releases}/update_2.6.sh (100%) create mode 100644 IOB-PI/update_3.1.sh diff --git a/IOB-PI/update_2.5.sh b/IOB-PI/old-releases/update_2.5.sh similarity index 100% rename from IOB-PI/update_2.5.sh rename to IOB-PI/old-releases/update_2.5.sh diff --git a/IOB-PI/update_2.6.sh b/IOB-PI/old-releases/update_2.6.sh similarity index 100% rename from IOB-PI/update_2.6.sh rename to IOB-PI/old-releases/update_2.6.sh diff --git a/IOB-PI/update_3.1.sh b/IOB-PI/update_3.1.sh new file mode 100644 index 0000000..abedba1 --- /dev/null +++ b/IOB-PI/update_3.1.sh @@ -0,0 +1,286 @@ +#!/bin/bash + +# script per update IOB-PI (file readParallela) secondo la tipologia del raspberry tra 8 e 12 ingressi + +revNum=`awk '/^Revision/ {sub("^1000", "", $3); print $3}' /proc/cpuinfo` +anno=2000 +model='na' +ram=0 + +# decodifica da questa tabella: https://elinux.org/RPi_HardwareHistory e https://ozzmaker.com/check-raspberry-software-hardware-version-command-line +case $revNum in + + 0002 | 0003 | 0004 | 0005 | 0006) + anno='2012' + model='B' + ram=256 + ;; + + 0007 | 0008 | 0009) + anno='2013' + model='A' + ram=256 + ;; + + 000d | 000e | 000f) + anno='2012' + model='B' + ram=512 + ;; + + 0010) + anno='2014' + model='B+' + ram=512 + ;; + + 0011) + anno='2014' + model='CM1' + ram=512 + ;; + + 0012) + anno='2014' + model='A+' + ram=256 + ;; + + 0013) + anno='2015' + model='B+' + ram=512 + ;; + + 0014) + anno='2014' + model='CM1' + ram=512 + ;; + + 0015) + anno='2014' + model='A+' + ram=512 + ;; + + a01040 | a01041 | a21042) + anno='2015' + model='2 Model B' + ram=1024 + ;; + + a22042) + anno='2016' + model='2 Model B' + ram=1024 + ;; + + 900021) + anno='2016' + model='A+' + ram=512 + ;; + + 900032) + anno='2016' + model='B+' + ram=512 + ;; + + 900092) + anno='2015' + model='Zero' + ram=512 + ;; + + 900093 | 920093) + anno='2016' + model='Zero' + ram=512 + ;; + + 9000c1) + anno='2017' + model='Zero W' + ram=512 + ;; + + a02082 | a22082 | a22082 | a32082) + anno='2016' + model='3 Model B' + ram=1024 + ;; + + a020a0) + anno='2017' + model='CM3' + ram=1024 + ;; + + a020d3) + anno='2018' + model='3 Model B+' + ram=1024 + ;; + + 9020e0) + anno='2018' + model='3 Model A+' + ram=512 + ;; + + a02100) + anno='2019' + model='CM3' + ram=1024 + ;; + + a03111) + anno='2019' + model='4 Model B' + ram=1024 + ;; + + b03111 | b03112) + anno='2019' + model='4 Model B' + ram=2048 + ;; + + b03114) + anno='2020' + model='4 Model B' + ram=2048 + ;; + + b03115) + anno='2022' + model='4 Model B' + ram=2048 + ;; + + c03111 | c03112) + anno='2019' + model='4 Model B' + ram=4096 + ;; + + c03114) + anno='2020' + model='4 Model B' + ram=4096 + ;; + + c03115) + anno='2022' + model='4 Model B' + ram=2048 + ;; + + d03114) + anno='2020' + model='4 Model B' + ram=8192 + ;; + + d03115) + anno='2022' + model='4 Model B' + ram=8192 + ;; + + + + 902120) + anno='2021' + model='Zero 2 W' + ram=512 + ;; + + *) + anno='2000' + model='Unknown' + ram=128 + ;; +esac + +echo "RPI $anno | model $model | RAM $ram" +echo "Revisione: $revNum" + +# default a 8 IN... +selIn=8 +# verifico anno/ram, se almeno 2014 e 1gb --> 12 bit... +if [ $anno -gt 2015 ] && [ $ram -gt 512 ]; then + selIn=12 +fi + +echo "Scelta versione $selIn ingressi" + + +# fermo esecuzione... +#/etc/init.d/MapoIOB stop +systemctl stop MapoIOB +echo "Arrestato servizio..." + +# fix permessi +chown pi:pi . -R + +# --- NUOVA LOGICA: Aggiorna IOB.cfg invece di copiare file python --- +echo "Aggiornamento IOB.cfg per $selIn ingressi..." +# Usa sed per trovare la riga numParams e cambiarla +sed -i "s/^numParams.*/numParams=$selIn/" IOB.cfg +# ------------------------------------------------------------------ + +# fix permessi +chown pi:pi . -R +chmod +x readP* + +# conf redis + +# aggiunta passwd accesso se mancante +file="/etc/redis/redis.conf" +line="24068Seriate" + +# Check if the line is missing +if grep -q "$line" "$file"; then + echo "requirepass ok!" +else + # execute the sed command + echo "requirepass missing! adding" + sed -i '/#requirepass*/a\requirepass 24068Seriate' $file +fi + + +# aggiunta criterio save da num changes +line="save 3600 1 600 10" +if grep -q "$line" "$file"; then + echo "save rdb OK" +else + # execute the sed command + echo "save rdb not found: adding!" + sed -i '/# save 3600*/a\save 3600 1 600 10 300 100 60 10000' $file +fi + + +# riportare bind a solo localhost +sed -i '/#bind 127.0.0.1*/c\bind 127.0.0.1 -::1' $file +# rimozione bind a rete globale x test +sed -i '/bind 0.0.0.0/c\#bind 0.0.0.0' $file + +# riavvio redis +systemctl restart redis + +# riavvio esecuzione... +systemctl restart MapoIOB +echo "Modifiche effettuate..." + +echo "Attenzione: verificare effettiva partenza servizio, per farlo digitare il comando" +echo "/etc/init.d/MapoIOB restart" +echo "--------------------------------" +echo "In particolare il file IOB.cfg deve contenere NMAXSEND = 5 nella sezione [time]" +echo "--------------------------------" +echo "Inoltre verificare presenza sezioni [blink] [invert] [filter]" +echo "------------------" + +