| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # Author: Steven Shiau <steven _at_ clonezilla org> |
| 3 | # License: GPL |
| 4 | |
| 5 | # Append a default search path. |
| 6 | PATH="$PATH:/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin" |
| 7 | export PATH |
| 8 | # Exclude some devices, like lo, sit0, lxc*... |
| 9 | # This is regular expression format. |
| 10 | exluding_dev="(lo|sit[0-9]+|lxc.*)" |
| 11 | export LC_ALL=C |
| 12 | if [scip-shell system . . `[`. -d /sys/class/net/scip-shell filesystem . . `/sys/class/net/`. ]; then |
| 13 | # kernel support sysfs, so get the NIC devices from /sys |
| 14 | NETDEVICES="$(unalias ls &>/dev/nullscip-shell filesystem . . `/dev/null`.; lsscip-shell system . . ls. /sys/class/net/scip-shell filesystem . . `/sys/class/net/`. | grepscip-shell system . . grep. -v -E "^$exluding_dev")" |
| 15 | elif [scip-shell system . . `[`. -f /proc/net/devscip-shell filesystem . . `/proc/net/dev`. ]; then |
| 16 | # kernel do not support sysfs, so get the NIC devices from /proc |
| 17 | NETDEVICES="$(catscip-shell system . . cat. /proc/net/devscip-shell filesystem . . `/proc/net/dev`. | grepscip-shell system . . grep. "^.*:" | cutscip-shell system . . cut. -d: -f1 | grepscip-shell system . . grep. -v -E "^$exluding_dev")" |
| 18 | else |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | echoscip-shell system . . echo. "$NETDEVICES" |
| 23 | exit 0 |