From 8bf1fafb99a357790edf1cd4cfda73f0f35858a9 Mon Sep 17 00:00:00 2001 From: kyodev Date: Mon, 18 Dec 2017 22:23:06 +0100 Subject: [PATCH] getIp 1.20.1 --- scripts/getIp | 24 ++++++++++++++---------- scripts/getIp_changelog.md | 4 ++++ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/scripts/getIp b/scripts/getIp index 8ac3e27..d10b8fd 100755 --- a/scripts/getIp +++ b/scripts/getIp @@ -1,7 +1,7 @@ #!/bin/bash -version=1.20.0 -date="14/12/2017" +version=1.20.1 +date="15/12/2017" projet="simpledeb" contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/" script="getIp" @@ -372,7 +372,7 @@ fi_ip_pub(){ #v 14/12/2017 } # $1=-4|-6, assigne $fg_ip, $fg_gws6, $fg_ifn, $fg_mac -figet_ip(){ # 14/12/2017 +figet_ip(){ # 15/12/2017 local target ifn x_ip=1 @@ -407,9 +407,10 @@ figet_ip(){ # 14/12/2017 # interface sortante if [ "$proto" == "-6" ]; then target=$( gawk '/proto ra / { print $1; exit}' <<< $( ip $proto -o route ) ) - fg_ifn_prior=$( ip $proto route get $target | sed -En 's/.*dev (.*) proto.*src ([0-9a-f:]+).*/\1/p' ) + fg_ifn_prior=$( ip $proto route get $target ) + fg_ifn_prior=$( ip $proto route get $target | sed -En 's/.*dev (.*) proto.*src ([0-9a-f:]+).*/\1 (\2)/p' ) else - fg_ifn_prior=$( ip $proto route get 255.255.255.255 | sed -En 's/.*dev (.*) src ([0-9.]+) .*/\1 \2/p' ) + fg_ifn_prior=$( ip $proto route get 255.255.255.255 | sed -En 's/.*dev (.*) src ([0-9.]+) .*/\1 (\2)/p' ) fi # ifnames & mac fg_ifn="" fg_mac="" @@ -671,10 +672,11 @@ fscript_update(){ # 6/12/2017 rm -rf "$dirTemp/" } -print_local(){ #v 11/12/2017 - local text +print_local(){ #v 15/12/2017 + local ifn_p4 text figet_ip "-4" || f__error "iproute2 doit être installé" "il remplace net-tools qui n'est plus développé" + ifn_p4="$fg_ifn_prior" f_pr titre1 "IPv4" f_pr l2 "$fg_ip" f_pr @@ -684,12 +686,14 @@ print_local(){ #v 11/12/2017 figet_ip "-6" f_pr titre1 "IPv6" f_pr l2 "$fg_ip" - f_pr - [ "$(f__wcv "-w" "$fg_ifn_prior")" -gt 1 ] && pluriel="s" || unset pluriel - f_pr l2 "interface"$pluriel" sortante"$pluriel": $fg_ifn_prior" '[ "$fg_ifn_prior" ]' f_pr [ "$(f__wcv "-l" "$fg_gws")" -gt 1 ] && pluriel="s" || unset pluriel f_pr l2 "passerelle"$pluriel": ${fg_gws//$'\n'/ ⊗ }" + f_pr + [ "$(f__wcv "-w" "$fg_ifn_prior")" -gt 1 ] && pluriel="s" || unset pluriel + f_pr l2 "interface"$pluriel" sortante"$pluriel" ipv6: $fg_ifn_prior" '[ "$fg_ifn_prior" ]' + [ "$(f__wcv "-w" "$ifn_p4")" -gt 1 ] && pluriel="s" || unset pluriel + f_pr l2 "interface"$pluriel" sortante"$pluriel" ipv4: $ifn_p4" '[ "$ifn_p4" ]' f_pr [ "$(f__wcv "-l" "$fg_mac")" -gt 1 ] && pluriel="s" || unset pluriel f_pr titre1 "adresse"$pluriel" Mac:" diff --git a/scripts/getIp_changelog.md b/scripts/getIp_changelog.md index 351f03a..17a09b6 100644 --- a/scripts/getIp_changelog.md +++ b/scripts/getIp_changelog.md @@ -1,6 +1,10 @@ # changelog getIp +## getIp 1.20.1 15/12/2017 + +* révision: affichage interface sortie ipv4 & ipv6 + ## getIp 1.20.0 14/12/2017 * révision: figer_ip + f__dir