File: travis_ifdown_nonlo.sh

package info (click to toggle)
datalad 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,148 kB
  • sloc: python: 69,414; sh: 1,521; makefile: 220
file content (17 lines) | stat: -rwxr-xr-x 481 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# Helper to bring interfaces down/up for testing
set -eu
if [ $1 = "down" ]; then
    NONLO=$(ifconfig | awk '/^[a-z]/{print $1;}' | grep -v '^lo$' | tr '\n' ' ' | sed -e 's, *$,,g')
    for i in $NONLO; do
        echo "I: bringing down $i" >&2
        sudo ifdown $i >&2
    done
    echo "export DATALAD_TESTS_NONLO='$NONLO'"
elif [ $1 = "up" ]; then
    for i in ${DATALAD_TESTS_NONLO}; do
        echo "I: bringing up $i" >&2
        sudo ifup $i >&2
    done

fi