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 "=========================================="