1
0
Fork 0
mirror of synced 2025-04-05 06:03:33 +03:00

Add NET_IF_BASE to change network interface easier

This commit is contained in:
Jonathan Almeida 2017-04-29 22:06:35 -04:00 committed by GitHub
parent cebf9f4361
commit 9a52f8e584

View file

@ -67,8 +67,9 @@ if [ "$(id -u)" != 0 ]; then
exiterr "Script must be run as root. Try 'sudo sh $0'"
fi
NET_IF0=${VPN_IFACE:-'eth0'}
NET_IFS=${VPN_IFACE:-'eth+'}
NET_IF_BASE='eth'
NET_IF0=${VPN_IFACE:-NET_IF_BASE'0'}
NET_IFS=${VPN_IFACE:-NET_IF_BASE'+'}
if_state=$(cat "/sys/class/net/$NET_IF0/operstate" 2>/dev/null)
if [ -z "$if_state" ] || [ "$if_state" = "down" ] || [ "$NET_IF0" = "lo" ]; then
printf "Error: Network interface '%s' is not available.\n" "$NET_IF0" >&2