Skip to content

Commit

Permalink
remote-connect: add error box
Browse files Browse the repository at this point in the history
Add an error log (using zenity) in case we fail to get a find the IP
address of the configured MAC.

Signed-off-by: Nuno Sa <[email protected]>
  • Loading branch information
nunojsa committed Jan 7, 2025
1 parent 65e4cf2 commit b0b98e6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion remote-connect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ command -v nmap > /dev/null || {
}

# Slowpath, let's run snmap...
IP_ADDR=$(pkexec nmap -sn ${NET_ADDR} | grep -C2 -i ${MAC_ADDR} | head -1 | grep -Eo '([[:digit:]]{1,3}.){3}[[:digit:]]{1,3}')
IP_ADDR=$(pkexec nmap -sn ${NET_ADDR} | grep -C2 -i ${MAC_ADDR} | head -1 | grep -Eo '([[:digit:]]{1,3}.){3}[[:digit:]]{1,3}') || {
zenity --error --text "Cannot grep new IP: NET=${NET_ADDR}, MAC=${MAC_ADDR}"
exit 1
}

# let's see if we can at least ping the new IP
ping ${IP_ADDR} -c 1 > /dev/null && {
echo "ip=${IP_ADDR}" >> ${CFG_FILE}
Expand Down

0 comments on commit b0b98e6

Please sign in to comment.