lokinet/vendor/libtuntap-master/regress/test36.sh

33 lines
505 B
Bash
Raw Normal View History

2018-06-23 12:18:31 +00:00
#!/bin/sh
# test36: Create a tun1 persistent device and release it
TEST="`pwd`/helper36"
SYSTEM=`uname`
TARGET='tun1'
TYPE='tun'
if [ "$SYSTEM" = "Linux" ]; then
IFDEL="ip tuntap del $TARGET mode $TYPE"
else
IFDEL="ifconfig $TARGET destroy"
fi
OK=0
$TEST && OK=1
# If the $TEST was a success, check if the interface still exist
if [ $OK -eq 1 ]; then
ifconfig $TARGET && OK=2
else
exit 1
fi
# The $TARGET still exists, clean it and exit success
if [ $OK -eq 2 ]; then
$IFDEL
exit 0
fi
exit 1