diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-03-21 07:47:15 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-03-21 08:00:02 +0000 |
commit | 58b1c5cf916324511569f31a3b0adc09d0d23a13 (patch) | |
tree | ade26fffd410b6934d3dc9b864bcf8ab8a58f370 /main/util-vserver/setup-vs-guest | |
parent | 1f57eb60222c4cc7aacdeecae111acf3db74feb0 (diff) | |
download | aports-58b1c5cf916324511569f31a3b0adc09d0d23a13.tar.bz2 aports-58b1c5cf916324511569f31a3b0adc09d0d23a13.tar.xz |
main/util-vserver: allow use bonded and bridge interfaces
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 985be9c3a..8d33f6c08 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 |