From 7c30ccd8f79445f8f152cb738806a9c2f082c961 Mon Sep 17 00:00:00 2001 From: PaulVua Date: Tue, 10 Mar 2026 11:42:46 +0100 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20r=C3=A9cap=20installation:?= =?UTF-8?q?=20IMSI,=20lien=20cliquable,=20suppression=20eth0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Capture l'IMSI dans une variable pour l'afficher dans le récap - Affiche l'URL complète http:///html/admin.html (cliquable dans le terminal) - Supprime la ligne eth0 (pas de connexion ethernet) Co-Authored-By: Claude Opus 4.6 --- installation_part2.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/installation_part2.sh b/installation_part2.sh index 085ea47..2153f56 100644 --- a/installation_part2.sh +++ b/installation_part2.sh @@ -63,7 +63,10 @@ sleep 1 #get SIM card IMSI info "Get SIM card IMSI" -/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara.py ttyAMA2 AT+CIMI 2 || warning "SARA IMSI read failed. Continuing..." +imsi_output=$(/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara.py ttyAMA2 AT+CIMI 2 2>&1) || warning "SARA IMSI read failed. Continuing..." +echo "$imsi_output" +# Extract IMSI (15-digit numeric string) +imsi_number=$(echo "$imsi_output" | grep -oP '^\d{15}$' || echo "N/A") #Connect to network #info "Connect SARA R4 to network" @@ -131,11 +134,17 @@ echo "==========================================" serial_number=$(cat /proc/cpuinfo | grep Serial | awk '{print substr($3, length($3) - 7)}' | tr '[:lower:]' '[:upper:]') echo -e "${BLUE}Device ID (Serial):${NC} $serial_number" -# Get IP addresses -ip_wlan0=$(ip -4 addr show wlan0 2>/dev/null | grep -oP '(?<=inet\s)\d+(\.\d+){3}' || echo "Not connected") -ip_eth0=$(ip -4 addr show eth0 2>/dev/null | grep -oP '(?<=inet\s)\d+(\.\d+){3}' || echo "Not connected") +# Display IMSI +echo -e "${BLUE}IMSI:${NC} ${imsi_number:-N/A}" -echo -e "${BLUE}IP Address (wlan0):${NC} $ip_wlan0" -echo -e "${BLUE}IP Address (eth0):${NC} $ip_eth0" +# Get IP address and make it a clickable link +ip_wlan0=$(ip -4 addr show wlan0 2>/dev/null | grep -oP '(?<=inet\s)\d+(\.\d+){3}' || echo "Not connected") + +if [[ "$ip_wlan0" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + admin_url="http://${ip_wlan0}/html/admin.html" + echo -e "${BLUE}IP Address (wlan0):${NC} ${admin_url}" +else + echo -e "${BLUE}IP Address (wlan0):${NC} $ip_wlan0" +fi echo "=========================================="