diff options
Diffstat (limited to 'main/util-vserver/setup-vs-guest')
-rw-r--r-- | main/util-vserver/setup-vs-guest | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/main/util-vserver/setup-vs-guest b/main/util-vserver/setup-vs-guest index 985be9c3ad..8d33f6c081 100644 --- a/main/util-vserver/setup-vs-guest +++ b/main/util-vserver/setup-vs-guest @@ -182,11 +182,30 @@ ask_hostname() { done } +available_ifaces() { + local iflist= ifpath= iface= i= + sorted_ifindexes=$( + for i in /sys/class/net/*/ifindex; do + [ -e "$i" ] || continue + echo -e "$(cat $i)\t$i"; + done | sort -n | awk '{print $2}') + for i in $sorted_ifindexes; do + ifpath=${i%/*} + iface=${ifpath##*/} + # skip interfaces that are part of a bond or bridge + if [ -d "$ifpath"/master/bonding ] || [ -d "$ifpath"/brport ]; then + continue + fi + iflist="${iflist}${iflist:+ }$iface" + done + echo $iflist +} + ask_ifaceopts() { # get ip address(es) resp= local ifaceopts= _def= _iface= - local ifaces=$(ip addr | awk -F: '$1 ~ /^[0-9]/ {printf "%s" $2} END {printf "\n"}') + local ifaces=$(available_ifaces) local last_iface=$(echo $ifaces | sed 's/.* //') while [ "$resp" != "done" ]; do if [ -z "$ifaces" ] || [ "$ifaces" = "lo " ] || [ -n "$ifaceopts" ]; then |