Skip to content
Snippets Groups Projects
Commit 2ec663a7 authored by fauno's avatar fauno
Browse files

no hardcodear el nombre de la red

parent b67c5be3
No related branches found
No related tags found
Loading
...@@ -62,14 +62,14 @@ fi ...@@ -62,14 +62,14 @@ fi
# Servicio de tinc@rap (si existe el principal) # Servicio de tinc@rap (si existe el principal)
if [ "${notincsv}" != true ]; then if [ "${notincsv}" != true ]; then
tincrapsvstatus="$(systemctl status tinc@rap || :)" tincrapsvstatus="$(systemctl status tinc@${NETWORK} || :)"
if [ -z "${tincrapsvstatus}" ]; then if [ -z "${tincrapsvstatus}" ]; then
msg_orange "No se encontró el servicio de tinc@rap" msg_orange "No se encontró el servicio de tinc@${NETWORK}"
else else
tincsv="$(systemctl show tinc@rap)" tincsv="$(systemctl show tinc@${NETWORK})"
echo "${tincsv}" | grep -q UnitFileState=enabled && enabled=si || enabled=no echo "${tincsv}" | grep -q UnitFileState=enabled && enabled=si || enabled=no
echo "${tincsv}" | grep -q ActiveState=active && active=si || active=no echo "${tincsv}" | grep -q ActiveState=active && active=si || active=no
msgtxt="Se encontró el servicio de tinc@rap: inicio en arranque=${enabled}, activo ahora=${active}" msgtxt="Se encontró el servicio de tinc@${NETWORK}: inicio en arranque=${enabled}, activo ahora=${active}"
if [ "${active}" = si ]; then msg "${msgtxt}" if [ "${active}" = si ]; then msg "${msgtxt}"
else msg_orange "${msgtxt}"; fi else msg_orange "${msgtxt}"; fi
fi fi
...@@ -78,25 +78,25 @@ fi ...@@ -78,25 +78,25 @@ fi
# Interface de red # Interface de red
iplink="$(ip link show "${NETWORK}" 2>/dev/null || :)" iplink="$(ip link show "${NETWORK}" 2>/dev/null || :)"
if [ -z "${iplink}" ]; then if [ -z "${iplink}" ]; then
msg_orange "No se encontró la interface de red de la rap" msg_orange "No se encontró la interface de red de la ${NETWORK}"
else else
echo "${iplink}" | grep -q 'state UNKNOWN' && interface=true || interface=false echo "${iplink}" | grep -q 'state UNKNOWN' && interface=true || interface=false
if [ "${interface}" != true ]; then if [ "${interface}" != true ]; then
msg_orange "Interface de red de la rap encontrada, pero caída" msg_orange "Interface de red de la ${NETWORK} encontrada, pero caída"
else else
msg "Interface de red de la rap encontrada y andando" msg "Interface de red de la ${NETWORK} encontrada y andando"
# IPv6 local # IPv6 local
ipaddress="$(ip address show "${NETWORK}" | grep inet6 | tr -s ' ' | cut -d' ' -f3)" ipaddress="$(ip address show "${NETWORK}" | grep inet6 | tr -s ' ' | cut -d' ' -f3)"
if [ -z "${ipaddress}" ]; then if [ -z "${ipaddress}" ]; then
msg_orange "No se encontró ninguna IP de rap" msg_orange "No se encontró ninguna IP de ${NETWORK}"
elif [ "$(echo "${ipaddress}" | wc -l)" -eq 1 ]; then elif [ "$(echo "${ipaddress}" | wc -l)" -eq 1 ]; then
msg_orange "Se encontró una sola IP: ${ipaddress}" msg_orange "Se encontró una sola IP: ${ipaddress}"
else else
iprap="$(echo "${ipaddress}" | grep "${ULA_PREFIX}" || :)" iprap="$(echo "${ipaddress}" | grep "${ULA_PREFIX}" || :)"
if [ -z "${iprap}" ]; then if [ -z "${iprap}" ]; then
msg_orange "Se encontraron varias IPs de rap, pero ninguna válida" msg_orange "Se encontraron varias IPs de ${NETWORK}, pero ninguna válida"
else else
msg "Tu IP de rap es: ${iprap}" msg "Tu IP de ${NETWORK} es: ${iprap}"
fi fi
fi fi
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment