summaryrefslogtreecommitdiff
path: root/src/validators/ethernet-interface
blob: 1bf9586972113f6cd5bafe141d5100ab17192fb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

if [[ "$1" != ^(lan|eth|eno|ens|enp|enx)[0-9]+$ ]]; then
    echo "Error: $1 is not an ethernet interface"
    exit 1
fi

if ! [ -d "/sys/class/net/$1" ]; then
    echo "Error: $1 interface does not exist in the system"
    exit 1
fi

exit 0